Chrome Extensions:
How to Build
2018
Becky Peltz
peltzr@seattleu.edu
WATS April Meetup
1
2
XKCD
Bio
BA, MBA University of Washington
Coding professionally since 1982
Application Developer
Many languages, Many architectures, Much technology
Solving problems!
Focus on fundamentals and standards
Companies include: Boeing, REI, Regence, Microsoft, go2Net, Expeditors, UW,
Seattle Public Schools, Seattle Children’s Hospital, F5 Networks, zulily, Globys,
Schweitzer Engineering Labs, North Seattle College, City University, Seattle
University
3
Agenda
What are Chrome Extensions?
Why spend time learning this?
Look at examples
Architecture of a Chrome Extension
Build them
Host them
Debugging & Performance
4
What are chrome extensions
Extensions are made from languages familiar to web
developers: HTML, CSS, JavaScript
5
What are chrome extensions
Use Chrome’s API to control inside and outside browser
window
https://developer.chrome.com/extensions/api_index
6
What are chrome extensions
Anchored to the Chrome Browser but not constrained to it -
no CORS
7
What are chrome extensions
API’s that give access to what’s inside a web page and
browser
8
Why Spend Time Learning This?
The web is a great place to solve problems
Use your web skills to solve problems
9
Why Spend Time Learning This?
Modular solutions to focused problems
You spend a lot of time in a browser so this is a good place to
implement a solution
10
Why Spend Time Learning This?
Web application without cross browser design concerns
11
Why Spend Time Learning This?
Experience working on an extension/plugin for a major
application
12
Why Spend Time Learning This?
Can make money from these $$
Cheap to host your solution
13
What can we do with Extensions?
Make an easily accessible tool
Add features and functionality to the Chrome browser
Access and modify content in web pages
Integrate with other apps
Host up to 20 web apps for $5/year (did I mention it was cheap?)
14
“Tip of the Iceberg”
15
Will it work?
16
Chrome Web Store
(> 8500 extensions in 2010)
Vist the Chrome web store:
https://chrome.google.com/webstore/category/extensions
17
Nothing is impossible, the word itself says ‘I’m possible’.
Audrey Hepburn
Examples
Google Earth View
Pablo https://photos.app.goo.gl/K6Uw2R2443ehK8HB3
Distill https://www.sitepoint.com/create-chrome-extension-10-minutes-flat/
Honey
XKCD
Screen Castify
Link Cat
18
Honey
19
Architecture and Terminology
20
Let’s Build and Host
Hello World
Link Cat
HTML Validator
https://docs.google.com/presentation/d/1HgrjKJLu0SeHbOEY_GGabe4YpNWYOWwpr-VlZ9LZqMo/edit?usp=sharing
Language Translator
https://docs.google.com/presentation/d/1LpntvWw-wFOVtw1JnSZLnUpw5iSwnnR2ktfoHfb_MFs/edit#slide=id.p
21
Debugging
Click on extension icon
Right click and inspect
Set a breakpoint in popup.js
In the console enter “location.reload()” to reload the code for debugging
Debugging Background pages
Also chrome://inspect/#extensions
22
Quick look: Selecting the container when user
selected text
Use this if you want to take action on user selection to help find container.
let select = window.getSelection();
if (select.rangeCount > 0) {
let node = select.getRangeAt(0).startContainer.parentNode;
console.log (node.id, node.name);
}
23
Quick look: Messaging using API’s
Send from Content:
chrome.runtime.sendMessage({greeting: "hello"}, function(response) {
console.log(response.farewell);
});
Send from Extension:
chrome.tabs.query({active: true, currentWindow: true}, function(tabs) {
chrome.tabs.sendMessage(tabs[0].id, {greeting: "hello"}, function(response) {
console.log(response.farewell);
});
});
Receive @ Content or Extension:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(sender.tab ?
"from a content script:" + sender.tab.url :
"from the extension");
if (request.greeting == "hello")
sendResponse({farewell: "goodbye"});
});
24
Quick look: Receiving message from content or
extension using API’s
Receive @ Content or Extension:
chrome.runtime.onMessage.addListener(
function(request, sender, sendResponse) {
console.log(sender.tab ?
"from a content script:" + sender.tab.url :
"from the extension");
if (request.greeting == "hello")
sendResponse({farewell: "goodbye"});
});
25
Performance
Use extensions task manager to analyze memory usage
26
Resources
27
Extension github Chrome store
Hello https://github.com/rebeccapeltz/hello-
chrome-ext
HTML Validator https://github.com/rebeccapeltz/html-
validate-ext
https://chrome.google.com/webstore/de
tail/html-
validator/bocbjjpebcmehmadhaiefilfieah
hcmo
Language Translator https://github.com/rebeccapeltz/chrome
-ext-translator
https://chrome.google.com/webstore/de
tail/language-
translator/fknddeibkpckpklmdjhpfiaikhfg
ddnb?hl=en
Email Link Category https://github.com/rebeccapeltz/link-cat https://chrome.google.com/webstore/de
tail/email-cat-
link/jomlhocpjgkjikblbginecclpgdkhobm
Google Resources
Google Video
https://developer.chrome.com/apps/about_apps
Google Examples
https://developer.chrome.com/apps/samples
28

More Related Content

PDF
What does people say when they switch to Go?
PDF
Web sessions in Developer Conferences
PDF
Herramientas tic
PPSX
0025 todo lo_que_queria_saber_de_html5_y_no_se_animaba_a_preguntar
PPT
Web 2.0
PPTX
Google chrome
PDF
Full-Stack Development
PPTX
Herramientas tic
What does people say when they switch to Go?
Web sessions in Developer Conferences
Herramientas tic
0025 todo lo_que_queria_saber_de_html5_y_no_se_animaba_a_preguntar
Web 2.0
Google chrome
Full-Stack Development
Herramientas tic

Similar to Intro chrome extensions (20)

PPT
Chrome Extension Develop Starts
PDF
Building & distributing chrome extensions and web apps
PPTX
Develop Chrome Extension
PPTX
Chrome extension 2014.08.03
PPTX
Web browser extensions development
PPTX
Google chrome extension
PPTX
Chrome Extension Step by step Guide .pptx
PPTX
Chrome Extension Development - Adam Horvath, Google Technology User Group, Sy...
PDF
Building Chrome Extensions
PDF
Chrome extensions
PDF
Creating chrome-extension
PPTX
Chrome extensions
PPTX
An overview on Developing Chrome Extensions
PDF
Building testable chrome extensions
PDF
Chrome Extensions for Web Hackers
PDF
Chrome extensions dev Intro
PDF
Browser Extensions for Web Hackers
PDF
Chrome Extensions - Basic concepts powerpoint
PPTX
Web Extensions Solve all Enterprise-y Everythings
ODP
Chrome extension development
Chrome Extension Develop Starts
Building & distributing chrome extensions and web apps
Develop Chrome Extension
Chrome extension 2014.08.03
Web browser extensions development
Google chrome extension
Chrome Extension Step by step Guide .pptx
Chrome Extension Development - Adam Horvath, Google Technology User Group, Sy...
Building Chrome Extensions
Chrome extensions
Creating chrome-extension
Chrome extensions
An overview on Developing Chrome Extensions
Building testable chrome extensions
Chrome Extensions for Web Hackers
Chrome extensions dev Intro
Browser Extensions for Web Hackers
Chrome Extensions - Basic concepts powerpoint
Web Extensions Solve all Enterprise-y Everythings
Chrome extension development
Ad

More from Rebecca Peltz (7)

PPTX
Hosting video js friends (2)
PPTX
Gitbook FAQs
PPTX
Gitbook Publish FAQ
PPTX
Meetup gitbook
PPTX
Make an html validator extension
PPTX
Make an language translator with voice extension
ODP
Ado Presentation
Hosting video js friends (2)
Gitbook FAQs
Gitbook Publish FAQ
Meetup gitbook
Make an html validator extension
Make an language translator with voice extension
Ado Presentation
Ad

Recently uploaded (20)

PDF
Topaz Photo AI Crack New Download (Latest 2025)
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
PDF-XChange Editor Plus 10.7.0.398.0 Crack Free Download Latest 2025
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
Tech Workshop Escape Room Tech Workshop
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
Airline CRS | Airline CRS Systems | CRS System
PPTX
Full-Stack Developer Courses That Actually Land You Jobs
PDF
Workplace Software and Skills - OpenStax
PDF
DNT Brochure 2025 – ISV Solutions @ D365
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PPTX
Plex Media Server 1.28.2.6151 With Crac5 2022 Free .
PDF
BoxLang Dynamic AWS Lambda - Japan Edition
PPTX
Python is a high-level, interpreted programming language
PDF
Microsoft Office 365 Crack Download Free
PDF
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
PPTX
Cybersecurity: Protecting the Digital World
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PDF
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]
Topaz Photo AI Crack New Download (Latest 2025)
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF-XChange Editor Plus 10.7.0.398.0 Crack Free Download Latest 2025
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
Tech Workshop Escape Room Tech Workshop
How Tridens DevSecOps Ensures Compliance, Security, and Agility
Airline CRS | Airline CRS Systems | CRS System
Full-Stack Developer Courses That Actually Land You Jobs
Workplace Software and Skills - OpenStax
DNT Brochure 2025 – ISV Solutions @ D365
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
Plex Media Server 1.28.2.6151 With Crac5 2022 Free .
BoxLang Dynamic AWS Lambda - Japan Edition
Python is a high-level, interpreted programming language
Microsoft Office 365 Crack Download Free
Top 10 Software Development Trends to Watch in 2025 🚀.pdf
Cybersecurity: Protecting the Digital World
Matchmaking for JVMs: How to Pick the Perfect GC Partner
novaPDF Pro 11.9.482 Crack + License Key [Latest 2025]

Intro chrome extensions

  • 1. Chrome Extensions: How to Build 2018 Becky Peltz [email protected] WATS April Meetup 1
  • 3. Bio BA, MBA University of Washington Coding professionally since 1982 Application Developer Many languages, Many architectures, Much technology Solving problems! Focus on fundamentals and standards Companies include: Boeing, REI, Regence, Microsoft, go2Net, Expeditors, UW, Seattle Public Schools, Seattle Children’s Hospital, F5 Networks, zulily, Globys, Schweitzer Engineering Labs, North Seattle College, City University, Seattle University 3
  • 4. Agenda What are Chrome Extensions? Why spend time learning this? Look at examples Architecture of a Chrome Extension Build them Host them Debugging & Performance 4
  • 5. What are chrome extensions Extensions are made from languages familiar to web developers: HTML, CSS, JavaScript 5
  • 6. What are chrome extensions Use Chrome’s API to control inside and outside browser window https://developer.chrome.com/extensions/api_index 6
  • 7. What are chrome extensions Anchored to the Chrome Browser but not constrained to it - no CORS 7
  • 8. What are chrome extensions API’s that give access to what’s inside a web page and browser 8
  • 9. Why Spend Time Learning This? The web is a great place to solve problems Use your web skills to solve problems 9
  • 10. Why Spend Time Learning This? Modular solutions to focused problems You spend a lot of time in a browser so this is a good place to implement a solution 10
  • 11. Why Spend Time Learning This? Web application without cross browser design concerns 11
  • 12. Why Spend Time Learning This? Experience working on an extension/plugin for a major application 12
  • 13. Why Spend Time Learning This? Can make money from these $$ Cheap to host your solution 13
  • 14. What can we do with Extensions? Make an easily accessible tool Add features and functionality to the Chrome browser Access and modify content in web pages Integrate with other apps Host up to 20 web apps for $5/year (did I mention it was cheap?) 14
  • 15. “Tip of the Iceberg” 15
  • 17. Chrome Web Store (> 8500 extensions in 2010) Vist the Chrome web store: https://chrome.google.com/webstore/category/extensions 17 Nothing is impossible, the word itself says ‘I’m possible’. Audrey Hepburn
  • 18. Examples Google Earth View Pablo https://photos.app.goo.gl/K6Uw2R2443ehK8HB3 Distill https://www.sitepoint.com/create-chrome-extension-10-minutes-flat/ Honey XKCD Screen Castify Link Cat 18
  • 21. Let’s Build and Host Hello World Link Cat HTML Validator https://docs.google.com/presentation/d/1HgrjKJLu0SeHbOEY_GGabe4YpNWYOWwpr-VlZ9LZqMo/edit?usp=sharing Language Translator https://docs.google.com/presentation/d/1LpntvWw-wFOVtw1JnSZLnUpw5iSwnnR2ktfoHfb_MFs/edit#slide=id.p 21
  • 22. Debugging Click on extension icon Right click and inspect Set a breakpoint in popup.js In the console enter “location.reload()” to reload the code for debugging Debugging Background pages Also chrome://inspect/#extensions 22
  • 23. Quick look: Selecting the container when user selected text Use this if you want to take action on user selection to help find container. let select = window.getSelection(); if (select.rangeCount > 0) { let node = select.getRangeAt(0).startContainer.parentNode; console.log (node.id, node.name); } 23
  • 24. Quick look: Messaging using API’s Send from Content: chrome.runtime.sendMessage({greeting: "hello"}, function(response) { console.log(response.farewell); }); Send from Extension: chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { chrome.tabs.sendMessage(tabs[0].id, {greeting: "hello"}, function(response) { console.log(response.farewell); }); }); Receive @ Content or Extension: chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { console.log(sender.tab ? "from a content script:" + sender.tab.url : "from the extension"); if (request.greeting == "hello") sendResponse({farewell: "goodbye"}); }); 24
  • 25. Quick look: Receiving message from content or extension using API’s Receive @ Content or Extension: chrome.runtime.onMessage.addListener( function(request, sender, sendResponse) { console.log(sender.tab ? "from a content script:" + sender.tab.url : "from the extension"); if (request.greeting == "hello") sendResponse({farewell: "goodbye"}); }); 25
  • 26. Performance Use extensions task manager to analyze memory usage 26
  • 27. Resources 27 Extension github Chrome store Hello https://github.com/rebeccapeltz/hello- chrome-ext HTML Validator https://github.com/rebeccapeltz/html- validate-ext https://chrome.google.com/webstore/de tail/html- validator/bocbjjpebcmehmadhaiefilfieah hcmo Language Translator https://github.com/rebeccapeltz/chrome -ext-translator https://chrome.google.com/webstore/de tail/language- translator/fknddeibkpckpklmdjhpfiaikhfg ddnb?hl=en Email Link Category https://github.com/rebeccapeltz/link-cat https://chrome.google.com/webstore/de tail/email-cat- link/jomlhocpjgkjikblbginecclpgdkhobm
  • 28. Google Resources Google Video https://developer.chrome.com/apps/about_apps Google Examples https://developer.chrome.com/apps/samples 28

Editor's Notes

  • #8: Web apps that take advantage of the fact that they are not running inside the browser container: no CORS restriction Cross origin resource sharing
  • #9: Can be ported to Firefox browser
  • #10: History: Before the Internet, we just argued about which language to write an app in. All apps were native. If you ran on Windows you had to have an app that compiled down to windows machine code and if it ran on unix it had to compile to that. If it was a IBM 3070 app it had to run in OS/VS. Once app devs realized that the web was a great place to deliver applications as well as documents, it became a question as to what kind of architecture and languages best supported that. We’ve gone through many mutations. You can look up things like Apache CGI, Tomcat, ASP, ASP.Net, and now we have JavaScript Frameworks talking to Rest interfaces. As you look for ways to encode your solutions, it seems to me that the closer your solution is to be based on Standards the longer life it will have. Chrome Extensions can be written in standard based HTML, CSS and JavaScript. They can also be converted to native mobile apps using Cordova.
  • #11: History: Before the Internet, we just argued about which language to write an app in. All apps were native. If you ran on Windows you had to have an app that compiled down to windows machine code and if it ran on unix it had to compile to that. If it was a IBM 3070 app it had to run in OS/VS. Once app devs realized that the web was a great place to deliver applications as well as documents, it became a question as to what kind of architecture and languages best supported that. We’ve gone through many mutations. You can look up things like Apache CGI, Tomcat, ASP, ASP.Net, and now we have JavaScript Frameworks talking to Rest interfaces. As you look for ways to encode your solutions, it seems to me that the closer your solution is to be based on Standards the longer life it will have. Chrome Extensions can be written in standard based HTML, CSS and JavaScript. They can also be converted to native mobile apps using Cordova.
  • #12: History: Before the Internet, we just argued about which language to write an app in. All apps were native. If you ran on Windows you had to have an app that compiled down to windows machine code and if it ran on unix it had to compile to that. If it was a IBM 3070 app it had to run in OS/VS. Once app devs realized that the web was a great place to deliver applications as well as documents, it became a question as to what kind of architecture and languages best supported that. We’ve gone through many mutations. You can look up things like Apache CGI, Tomcat, ASP, ASP.Net, and now we have JavaScript Frameworks talking to Rest interfaces. As you look for ways to encode your solutions, it seems to me that the closer your solution is to be based on Standards the longer life it will have. Chrome Extensions can be written in standard based HTML, CSS and JavaScript. They can also be converted to native mobile apps using Cordova.
  • #13: History: Before the Internet, we just argued about which language to write an app in. All apps were native. If you ran on Windows you had to have an app that compiled down to windows machine code and if it ran on unix it had to compile to that. If it was a IBM 3070 app it had to run in OS/VS. Once app devs realized that the web was a great place to deliver applications as well as documents, it became a question as to what kind of architecture and languages best supported that. We’ve gone through many mutations. You can look up things like Apache CGI, Tomcat, ASP, ASP.Net, and now we have JavaScript Frameworks talking to Rest interfaces. As you look for ways to encode your solutions, it seems to me that the closer your solution is to be based on Standards the longer life it will have. Chrome Extensions can be written in standard based HTML, CSS and JavaScript. They can also be converted to native mobile apps using Cordova.
  • #14: History: Before the Internet, we just argued about which language to write an app in. All apps were native. If you ran on Windows you had to have an app that compiled down to windows machine code and if it ran on unix it had to compile to that. If it was a IBM 3070 app it had to run in OS/VS. Once app devs realized that the web was a great place to deliver applications as well as documents, it became a question as to what kind of architecture and languages best supported that. We’ve gone through many mutations. You can look up things like Apache CGI, Tomcat, ASP, ASP.Net, and now we have JavaScript Frameworks talking to Rest interfaces. As you look for ways to encode your solutions, it seems to me that the closer your solution is to be based on Standards the longer life it will have. Chrome Extensions can be written in standard based HTML, CSS and JavaScript. They can also be converted to native mobile apps using Cordova.
  • #21: Browser Action: icon in google chrome toolbar (can also have a tooltip, a badge and a popup) for all pages Page Action: icon will not be enabled unless the page has meets some criteria Note that tooltip will show whether or not the icon is enabled
  • #25: https://developer.chrome.com/extensions/messaging