SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Chrome extensions
development
Michal Haták
twista.cz
@twistacz
http://sli.do/ctvrtkon
What are extensions?
●

Applications running inside Chrome browser

●

Provide additional functionality or customize browser experience

●

Written using HTML, Javascript and CSS

●

Integrated using simple chrome.* API
What are extensions?
●

Installed instantly

●

Updated automatically

●

Run in separate processes
Why Chrome instead of ….
Chrome is most used browser since May 2012
http://gs.statcounter.com/#browser-ww-monthly-201201-201401
Motivation
●

●

●

Small learning curve
Easy to distribute via
chrome.google.com/webstore
Permanent presence in browser
Structure of extension
●

Compressed file (.crx) composed of:
–

Manifest file

–

Optional HTML/CSS files

–

Optional Javascript files

–

Statics (images etc.)
Manifest
●

Every extension, installable web app, and
theme has a JSON-formatted manifest file,
named manifest.json, that provides important
information.

developer.chrome.com/extensions/manifest.html
manifest.json
{
"name": "Read it later!",
"version": "0.9.0",
"manifest_version": 2,
"description": "Enables save websites for later, no ads, no logins",
"browser_action": {
"default_icon": "img/icon48.png",
"default_popup": "popup.html"
},
"default_locale": "en",
"icons": {
"128": "img/icon128.png"
},
"offline_enabled": true,
"permissions": [
"contextMenus",
"storage",
"tabs"
],
"background": {
"scripts": [
"background.js"
]
}
Browser components
●

Browser action (popup)

●

Page action

●

Content scripts

●

Background page

●

Omnibox
Browser action - popup
●

Icon in chrome bar

●

Can contain HTML content (onclick)

●

Chrome badge
Page action
●

Icon in Omnibox

●

Can contain HTML/JS content

●

Just on specific pages
Omnibox
Content script
●

●

●

Javascript which runs on page specified in
manifest (can be regexp)
Content script has access to the DOM of HTML
page, but runs on its isolated container
Can pass messages with the background page
+------------------------------------| background page
|------------------------------------|
|
+--------------------------------+
| web page
|
|--------------------------------|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
^
|
|
|
|
|
|
|
|--------------------------|----|
^
|
|
|
|
|
+------------

------+
+-------------------|------------+
|

|
| content script
Background page
●

●

background page is an HTML page that runs in
the extension process
It exists for the lifetime of your extension, and
only one instance of it at a time is active*
*Exception if extension uses incognito „split mode“
Ok, what's next?
●

chrome.* APIs

●

Permissions

●

Distribution
chrome.* APIs
●

●

chrome is the top-level object and exposes
many interesting APIs
common:
–

chrome.browserAction.*

–

chrome.contextMenus.*

–

chrome.debugger.*

–

chrome.notifications.*

–

chrome.omnibox.*

–

chrome.storage.*

–

chrome.tabs.*

- local/sync
chrome.* APIs
●

Less common APIs
–

chrome.i18n.*

- translations

–

chrome.power.* - system's power management

–

chrome.events.*

–

chrome.downloads.*

–

chrome.devtools.*

–

chrome.commands.*

–

chrome.alarms.*

- schedule code to run

developer.chrome.com/extensions/api_index.html
Permissions
●

●

Extension or app must declare its intent in the
"permissions" field (manifest)
Each permission can be either one of a list of
known strings (such as "downloads") or a
match pattern
Permissions examples
●

tabs

●

bookmarks

●

http://*.google.com/

●

http://*/*

●

<all_urls>
Distribution - Chrome Web Store
●

Apps, Themes, Extensions

●

$5 signup fee – forever

●

Chrome Web Store Payments
Let's start – demo time
●

Twista/chrome-skeleton

●

Simple skeleton for easy development

git clone http://git.twista.cz/chromeskeleton
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Building Chrome Extensions
Building Chrome ExtensionsBuilding Chrome Extensions
Building Chrome Extensions
Ron Reiter
 
Effective TDD - Less is more
Effective TDD - Less is moreEffective TDD - Less is more
Effective TDD - Less is more
Ben Lau
 
Google chrome extension
Google chrome extensionGoogle chrome extension
Google chrome extension
Johnny Kingdom
 
Friendly iframes
Friendly iframesFriendly iframes
Friendly iframes
miclumbroso
 
Leksion 1 hyrje ne xhtml
Leksion 1   hyrje ne xhtmlLeksion 1   hyrje ne xhtml
Leksion 1 hyrje ne xhtml
mariokenga
 
Website cloning using backtrack 5
Website cloning using backtrack 5Website cloning using backtrack 5
Website cloning using backtrack 5
Tamajit Chakraborty
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
Uma Sam
 

Was ist angesagt? (20)

Chrome extensions
Chrome extensionsChrome extensions
Chrome extensions
 
Introduction of chrome extension development
Introduction of chrome extension developmentIntroduction of chrome extension development
Introduction of chrome extension development
 
Building Chrome Extensions
Building Chrome ExtensionsBuilding Chrome Extensions
Building Chrome Extensions
 
Introduction to chrome extension development
Introduction to chrome extension developmentIntroduction to chrome extension development
Introduction to chrome extension development
 
Effective TDD - Less is more
Effective TDD - Less is moreEffective TDD - Less is more
Effective TDD - Less is more
 
Google chrome extension
Google chrome extensionGoogle chrome extension
Google chrome extension
 
Orange is the new blue: How to port Chrome Extension to Firefox Extension
Orange is the new blue: How to port Chrome Extension to Firefox ExtensionOrange is the new blue: How to port Chrome Extension to Firefox Extension
Orange is the new blue: How to port Chrome Extension to Firefox Extension
 
Develop Chrome Extension
Develop Chrome ExtensionDevelop Chrome Extension
Develop Chrome Extension
 
Dive Into Chrome-100119
Dive Into Chrome-100119Dive Into Chrome-100119
Dive Into Chrome-100119
 
Creating chrome-extension
Creating chrome-extensionCreating chrome-extension
Creating chrome-extension
 
Chrome Extension
Chrome ExtensionChrome Extension
Chrome Extension
 
Browser extension
Browser extensionBrowser extension
Browser extension
 
Friendly iframes
Friendly iframesFriendly iframes
Friendly iframes
 
WordPress Theme & Plugin i18n & L10n
WordPress Theme & Plugin i18n & L10nWordPress Theme & Plugin i18n & L10n
WordPress Theme & Plugin i18n & L10n
 
Leksion 1 hyrje ne xhtml
Leksion 1   hyrje ne xhtmlLeksion 1   hyrje ne xhtml
Leksion 1 hyrje ne xhtml
 
Web Fundamentals
Web FundamentalsWeb Fundamentals
Web Fundamentals
 
Website cloning using backtrack 5
Website cloning using backtrack 5Website cloning using backtrack 5
Website cloning using backtrack 5
 
Metarefresh
MetarefreshMetarefresh
Metarefresh
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Disruptive code
Disruptive codeDisruptive code
Disruptive code
 

Ähnlich wie Chrome extension development

Web browser extension development
Web browser extension developmentWeb browser extension development
Web browser extension development
alecsrusu
 
Chrome Apps & Extensions
Chrome Apps & ExtensionsChrome Apps & Extensions
Chrome Apps & Extensions
Varun Raj
 

Ähnlich wie Chrome extension development (20)

Web-Technologies 26.06.2003
Web-Technologies 26.06.2003Web-Technologies 26.06.2003
Web-Technologies 26.06.2003
 
SPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFxSPUnite17 Building Great Client Side Web Parts with SPFx
SPUnite17 Building Great Client Side Web Parts with SPFx
 
Html5
Html5Html5
Html5
 
CMS & Chrome Extension Development
CMS & Chrome Extension DevelopmentCMS & Chrome Extension Development
CMS & Chrome Extension Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
unit1 part 1 sem4 php.docx
unit1 part 1 sem4 php.docxunit1 part 1 sem4 php.docx
unit1 part 1 sem4 php.docx
 
HAXTheWeb @ Apereo 19
HAXTheWeb @ Apereo 19HAXTheWeb @ Apereo 19
HAXTheWeb @ Apereo 19
 
Change by HTML5
Change by HTML5Change by HTML5
Change by HTML5
 
Building high performing web pages
Building high performing web pagesBuilding high performing web pages
Building high performing web pages
 
Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)Simpler Web Architectures Now! (At The Frontend 2016)
Simpler Web Architectures Now! (At The Frontend 2016)
 
POX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia APIPOX to HATEOAS: Our Company's Journey Building a Hypermedia API
POX to HATEOAS: Our Company's Journey Building a Hypermedia API
 
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
SophiaConf2010 Présentation des Retours d'expériences de la Conférence du 08 ...
 
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가토크릴레이 1탄 html5 전망 (전종홍 박사)
 
전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)
전문가 토크릴레이 1탄 html5 전망 (전종홍 박사)
 
Web browser extension development
Web browser extension developmentWeb browser extension development
Web browser extension development
 
Chrome Extensions - Basic concepts powerpoint
Chrome Extensions - Basic concepts powerpointChrome Extensions - Basic concepts powerpoint
Chrome Extensions - Basic concepts powerpoint
 
Html5
Html5Html5
Html5
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 
CGI by rj
CGI by rjCGI by rj
CGI by rj
 
Chrome Apps & Extensions
Chrome Apps & ExtensionsChrome Apps & Extensions
Chrome Apps & Extensions
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Kürzlich hochgeladen (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Chrome extension development