SlideShare a Scribd company logo
Chrome Extension Development Starts Xu Jiwei ohdarling88 at gmail d0t com 2010.01.17
Who is this guy Xu Jiwei ohdarling88 at gmail d0t com http://www.xujiwei.com F2E of Taobao UED Author of Chrome WangWang Extension
TOC Introduction User Interface Structure Programming Resources
What’s Chrome? Are you kidding?!
Chrome Fast start-up Google Chrome launches in a snap. Fast loading Google Chrome loads web pages quickly. Fast search Search the web right from the address bar. more:  http://www.google.com/chrome/intl/en/features_mac.html
Then, What is the Chrome Extension? Extensions are small software programs that can modify and enhance the functionality of Google Chrome. You write them using web technologies such as HTML, JavaScript, and CSS. Also you can use NPAPI plugin written by C++ or other language in your extension.
What can extension do? A client of some services Gmail Checker,  Metrist A assistant utility Proxy Switchy,  AutoExpander An enhancement feature History2
How user to use?
User Interface Browser Action or it’s popup Page Action or it’s popup Extension’s pages
Browser Action
Browser Action Shown in Chrome’s main toolbar Could show a Badge for notification Could show a popup for more detail view At most ONE browser action allowed Some tips
Page Action
Page Action Display on the right of address bar By default the icon is hidden Only show under specified conditions At most ONE page action too
Extension’s Page
Extension’s Page You can browse a page of your extension with the protocol “chrome-extension://” chrome-extension://{extension-id}/path/to/page.html But the url is not shown in the address bar
Override Page? A extension’s page with SPECIAL chrome url, eg: chrome://newtab/ Currently only “new tab” page can be override DO NOT make a page similar to the default “new tab” page Except more useful or faster than the default “new tab” page Otherwise DON’T override the new tab page
Options Page? It’s just a normal extension page too But the page can be directly opened by clicking “Options” button in Extensions Management Page For saving settings of your extension only NO differences to a normal extension page
and, Popup Page? It is also a normal extension page.
Background tasks Or your extension doesn’t need interact with user, just do some background tasks Like Chrome WangWang Protocol Handler
How to build?
Directory Structure extension manifest.json background.htm, content_script.js _locales/ zh_CN/ messages.json en_US/
manifest.json Core configuration file Extension name, description, logo, update url and etc. Specify the background page, content scripts, option page, actions. Permissions
Background Page Every extension has at most ONE background page Background page is always running while Chrome is running For background tasks
Content Scripts Toggle page action and browser action’s visibility Access the web page’s DOM
How to program?
APIs
Chrome Extension’s API chrome.extension.* chrome.pageAction.* chrome.browserAction.* chrome.tabs.* chrome.windows.* chrome.bookmarks.* etc ...
Asynchronous API Always use callback to get api’s return value chrome.bookmarks.getTree(function(treeNodes) { // processing bookmarks’ tree }
Event driven Just like DOM Events chrome.pageAction.onClicked.addListener(function() { // do something }) chrome.tabs.onUpdated.addListener(function() { // do something })
Most of the apis are ASYNCHRONOUS ASYNCHRONOUS
Security and Sandbox Cross domain XHR is allowed “ Permission ” property in manifest.json JavaScript of Extension and web pages are running in two separated environments
Message Passing Communications in content scripts and background page, or other extension’s page Because API limits in content scripts Encoding
Message Passing Chrome Extension Background Page Content Scripts Page Action Browser Action Popup page, Options page, etc.
Extension’s Resource All files of your extension is accessible Just use the protocol “chrome-extension://” Use XHR in web pages to get extension’s file
i18n chrome.i18n.* Localized strings stored in _locales/{lang}/messages.json chrome.i18n.getMessage getMessage message name data Lookup localized string and format with data Localized string
How to publish?
Package If you publish the extension on Google Official Chrome Extensions site, this step should be  SKIPPED Before publishing your extension, you must package it as a “crx” file Without any other tools, Chrome is enough Protect your private key file, it’s very IMPORTANT
Auto Updating Tell Chrome to update your extension from somewhere Be careful about “version” in manifest.json Set “update_url” in manifest.json It is NOT required if you want to publish it on Google Official Extensions site
Publish Official Chrome Extensions Site https://chrome.google.com/extensions/developer/dashboard Note: Upload the source of you extension... Chrome Extensions http://www.chromeextensions.org/
Resources Chrome Extension’s Documentation Google Chrome Extensions Site Chrome Extensions Source code
Thanks

More Related Content

ODP
Chrome extension development
Michal Haták
 
PPTX
Chrome Extension Development - Adam Horvath, Google Technology User Group, Sy...
adamhorvath
 
PPTX
Build your own Chrome Extension with AngularJS
flrent
 
PDF
Discovering Chrome Extensions
Àlex Cabrera Gil
 
PPTX
Chrome extensions
Aleks Zinevych
 
PDF
Chrome extensions
Ahmad Tahhan
 
PDF
Chrome extension development
Mārtiņš Balodis
 
PDF
Building Chrome Extensions
Ron Reiter
 
Chrome extension development
Michal Haták
 
Chrome Extension Development - Adam Horvath, Google Technology User Group, Sy...
adamhorvath
 
Build your own Chrome Extension with AngularJS
flrent
 
Discovering Chrome Extensions
Àlex Cabrera Gil
 
Chrome extensions
Aleks Zinevych
 
Chrome extensions
Ahmad Tahhan
 
Chrome extension development
Mārtiņš Balodis
 
Building Chrome Extensions
Ron Reiter
 

What's hot (20)

PDF
HTML5 and Google Chrome - DevFest09
mihaiionescu
 
PPTX
Google chrome extension
Johnny Kingdom
 
PDF
Introduction to chrome extension development
KAI CHU CHUNG
 
PDF
Introduction of chrome extension development
Balduran Chang
 
PPTX
Orange is the new blue: How to port Chrome Extension to Firefox Extension
chaykaborya
 
ODP
Making Chrome Extension with AngularJS
Ben Lau
 
ODP
Effective TDD - Less is more
Ben Lau
 
PPTX
Develop Chrome Extension
Aleksandr Golovatyi
 
PDF
Creating chrome-extension
Akshay Khale
 
PPTX
Chrome Extension
Andrei McMillan
 
KEY
Dive Into Chrome-100119
yiming he
 
POT
Browser extension
Cosmin Stefanache
 
PPTX
WordPress Theme & Plugin i18n & L10n
codebangla
 
PPT
Web Fundamentals
arunv
 
PDF
Metarefresh
Aakash Bapna
 
PDF
Meta Refresh 2014
Aakash Bapna
 
PDF
Leksion 1 hyrje ne xhtml
mariokenga
 
PDF
Chapter 1
Uma Sam
 
PDF
Javascript cross domain communication
ChenKuo Chen
 
PDF
Essential Javascript -- A Javascript <b>Tutorial</b>
tutorialsruby
 
HTML5 and Google Chrome - DevFest09
mihaiionescu
 
Google chrome extension
Johnny Kingdom
 
Introduction to chrome extension development
KAI CHU CHUNG
 
Introduction of chrome extension development
Balduran Chang
 
Orange is the new blue: How to port Chrome Extension to Firefox Extension
chaykaborya
 
Making Chrome Extension with AngularJS
Ben Lau
 
Effective TDD - Less is more
Ben Lau
 
Develop Chrome Extension
Aleksandr Golovatyi
 
Creating chrome-extension
Akshay Khale
 
Chrome Extension
Andrei McMillan
 
Dive Into Chrome-100119
yiming he
 
Browser extension
Cosmin Stefanache
 
WordPress Theme & Plugin i18n & L10n
codebangla
 
Web Fundamentals
arunv
 
Metarefresh
Aakash Bapna
 
Meta Refresh 2014
Aakash Bapna
 
Leksion 1 hyrje ne xhtml
mariokenga
 
Chapter 1
Uma Sam
 
Javascript cross domain communication
ChenKuo Chen
 
Essential Javascript -- A Javascript <b>Tutorial</b>
tutorialsruby
 
Ad

Viewers also liked (20)

PDF
20100915 學習撰寫 Google Chrome Extension
Justin Lee
 
PPT
A Complete Guide To Chrome Extension Development
Steven James
 
PPT
Introduction To Browser Extension Development
Steven James
 
POT
Browser extension
Cosmin Stefanache
 
PDF
Introduction to Google Chrome Extensions Development
Jomar Tigcal
 
PDF
Introduction to Web Browser Extension/Add-ons
Pranav Gupta
 
PPT
De patient José Van Der Schoor
MijnZorgnet
 
PDF
21st Century Construction Toolkit - Olswang LLP
Francis Ho
 
DOC
Holisticmanagement Of Global Recession Dr. Shriniwas Kashalikar
shriniwaskashalikar
 
DOC
Total Stress Management Guide For Nurses Dr Shriniwas Kashalikar
shriniwaskashalikar
 
PDF
Ranking analysis-12-20-2011-1
SEO, LLC dba www.SplinternetMarketing.com
 
PPTX
東海大学広報メディア学科河井ゼミ フリーペーパー2014
河井 孝仁
 
DOC
Master key system part 20
canei2day
 
PPTX
東海大学広報メディア学科河井ゼミ2014年度最終発表_ゆるキャラ
河井 孝仁
 
PPTX
教學訪問教師試辦計畫106學年度說明會簡報
Josephine C
 
PDF
SEC Whistleblower Article
SamLieberman
 
PPT
Geneesmiddelengebruik Arjan Van Nistelrooij
MijnZorgnet
 
DOC
Walaval Dr. Shriniwas Kashalikar
shriniwaskashalikar
 
PDF
Internet Marketing Report Splinternetmarketing.Com Internet Marketing Solutio...
SEO, LLC dba www.SplinternetMarketing.com
 
PPTX
Jamia Ikhwan
Nova Studio Pro
 
20100915 學習撰寫 Google Chrome Extension
Justin Lee
 
A Complete Guide To Chrome Extension Development
Steven James
 
Introduction To Browser Extension Development
Steven James
 
Browser extension
Cosmin Stefanache
 
Introduction to Google Chrome Extensions Development
Jomar Tigcal
 
Introduction to Web Browser Extension/Add-ons
Pranav Gupta
 
De patient José Van Der Schoor
MijnZorgnet
 
21st Century Construction Toolkit - Olswang LLP
Francis Ho
 
Holisticmanagement Of Global Recession Dr. Shriniwas Kashalikar
shriniwaskashalikar
 
Total Stress Management Guide For Nurses Dr Shriniwas Kashalikar
shriniwaskashalikar
 
Ranking analysis-12-20-2011-1
SEO, LLC dba www.SplinternetMarketing.com
 
東海大学広報メディア学科河井ゼミ フリーペーパー2014
河井 孝仁
 
Master key system part 20
canei2day
 
東海大学広報メディア学科河井ゼミ2014年度最終発表_ゆるキャラ
河井 孝仁
 
教學訪問教師試辦計畫106學年度說明會簡報
Josephine C
 
SEC Whistleblower Article
SamLieberman
 
Geneesmiddelengebruik Arjan Van Nistelrooij
MijnZorgnet
 
Walaval Dr. Shriniwas Kashalikar
shriniwaskashalikar
 
Internet Marketing Report Splinternetmarketing.Com Internet Marketing Solutio...
SEO, LLC dba www.SplinternetMarketing.com
 
Jamia Ikhwan
Nova Studio Pro
 
Ad

Similar to Chrome Extension Develop Starts (20)

PDF
Chrome Extensions - Basic concepts powerpoint
f20190876
 
PPTX
Web browser extensions development
dragoslargu
 
PDF
Browser Extensions for Web Hackers
Mark Wubben
 
PDF
Chrome Extensions for Web Hackers
Mark Wubben
 
PPTX
Chrome Apps & Extensions
Varun Raj
 
PPTX
CMS & Chrome Extension Development
Sarang Ananda Rao
 
PDF
Chrome Developer Tools - Pro Tips & Tricks
Mars Devs
 
PPTX
Chrome Extension Step by step Guide .pptx
geekhouse.io
 
ODP
How and Why to extend Firefox
Graham King
 
PPTX
Make an language translator with voice extension
Rebecca Peltz
 
PPT
Browser Extension
Jack Selva
 
PDF
Google Chrome Extensions - DevFest09
mihaiionescu
 
PPTX
Google Chrome DevTools features overview
Oleksii Prohonnyi
 
PPTX
Cliw - extension development
vicccuu
 
PDF
Chrome Extensions Slides Gtugna Kick Off Meeti
Stephan Linzner
 
PDF
Chrome Extensions for Hackers
Cristiano Betta
 
ODP
More Browser Basics, Tips & Tricks 3 Draft 8
msz
 
PDF
Chrome extensions dev Intro
Luis Alfredo Porras Páez
 
PPTX
Creating custom chrome extensions
valuebound
 
PPTX
Google chrome
Paramjeet Rawat
 
Chrome Extensions - Basic concepts powerpoint
f20190876
 
Web browser extensions development
dragoslargu
 
Browser Extensions for Web Hackers
Mark Wubben
 
Chrome Extensions for Web Hackers
Mark Wubben
 
Chrome Apps & Extensions
Varun Raj
 
CMS & Chrome Extension Development
Sarang Ananda Rao
 
Chrome Developer Tools - Pro Tips & Tricks
Mars Devs
 
Chrome Extension Step by step Guide .pptx
geekhouse.io
 
How and Why to extend Firefox
Graham King
 
Make an language translator with voice extension
Rebecca Peltz
 
Browser Extension
Jack Selva
 
Google Chrome Extensions - DevFest09
mihaiionescu
 
Google Chrome DevTools features overview
Oleksii Prohonnyi
 
Cliw - extension development
vicccuu
 
Chrome Extensions Slides Gtugna Kick Off Meeti
Stephan Linzner
 
Chrome Extensions for Hackers
Cristiano Betta
 
More Browser Basics, Tips & Tricks 3 Draft 8
msz
 
Chrome extensions dev Intro
Luis Alfredo Porras Páez
 
Creating custom chrome extensions
valuebound
 
Google chrome
Paramjeet Rawat
 

More from taobao.com (20)

PPT
编辑器设计U editor
taobao.com
 
PDF
Berserk js
taobao.com
 
PPTX
淘宝开放产品前端实践
taobao.com
 
PPTX
广告投放代码和创意代码持续优化
taobao.com
 
PPTX
第三方内容开发最佳实践
taobao.com
 
PDF
编辑器设计Kissy editor
taobao.com
 
PDF
百度前端性能监控与优化实践
taobao.com
 
PPT
Node.js在淘宝的应用实践
taobao.com
 
PDF
Kind editor设计思路
taobao.com
 
PDF
Java script physical engine
taobao.com
 
PPTX
Html5环保小游戏
taobao.com
 
PDF
阅读类Web应用前端技术探索
taobao.com
 
PPTX
完颜:移动网站的兼容性探索
taobao.com
 
PPTX
张平:JavaScript引擎实现
taobao.com
 
PPTX
高力:19楼现有前端架构
taobao.com
 
PDF
李成银:前端编译平台
taobao.com
 
PDF
钱宝坤:多浏览器集成的JavaScript单元测试工具
taobao.com
 
PDF
张克军:前端基础架构的实践和思考
taobao.com
 
PDF
刘平川:【用户行为分析】Marmot实践
taobao.com
 
PDF
吴英杰:【用户行为分析】淘宝页面显微镜系统原理及实践
taobao.com
 
编辑器设计U editor
taobao.com
 
Berserk js
taobao.com
 
淘宝开放产品前端实践
taobao.com
 
广告投放代码和创意代码持续优化
taobao.com
 
第三方内容开发最佳实践
taobao.com
 
编辑器设计Kissy editor
taobao.com
 
百度前端性能监控与优化实践
taobao.com
 
Node.js在淘宝的应用实践
taobao.com
 
Kind editor设计思路
taobao.com
 
Java script physical engine
taobao.com
 
Html5环保小游戏
taobao.com
 
阅读类Web应用前端技术探索
taobao.com
 
完颜:移动网站的兼容性探索
taobao.com
 
张平:JavaScript引擎实现
taobao.com
 
高力:19楼现有前端架构
taobao.com
 
李成银:前端编译平台
taobao.com
 
钱宝坤:多浏览器集成的JavaScript单元测试工具
taobao.com
 
张克军:前端基础架构的实践和思考
taobao.com
 
刘平川:【用户行为分析】Marmot实践
taobao.com
 
吴英杰:【用户行为分析】淘宝页面显微镜系统原理及实践
taobao.com
 

Chrome Extension Develop Starts

  • 1. Chrome Extension Development Starts Xu Jiwei ohdarling88 at gmail d0t com 2010.01.17
  • 2. Who is this guy Xu Jiwei ohdarling88 at gmail d0t com http://www.xujiwei.com F2E of Taobao UED Author of Chrome WangWang Extension
  • 3. TOC Introduction User Interface Structure Programming Resources
  • 4. What’s Chrome? Are you kidding?!
  • 5. Chrome Fast start-up Google Chrome launches in a snap. Fast loading Google Chrome loads web pages quickly. Fast search Search the web right from the address bar. more: http://www.google.com/chrome/intl/en/features_mac.html
  • 6. Then, What is the Chrome Extension? Extensions are small software programs that can modify and enhance the functionality of Google Chrome. You write them using web technologies such as HTML, JavaScript, and CSS. Also you can use NPAPI plugin written by C++ or other language in your extension.
  • 7. What can extension do? A client of some services Gmail Checker, Metrist A assistant utility Proxy Switchy, AutoExpander An enhancement feature History2
  • 8. How user to use?
  • 9. User Interface Browser Action or it’s popup Page Action or it’s popup Extension’s pages
  • 11. Browser Action Shown in Chrome’s main toolbar Could show a Badge for notification Could show a popup for more detail view At most ONE browser action allowed Some tips
  • 13. Page Action Display on the right of address bar By default the icon is hidden Only show under specified conditions At most ONE page action too
  • 15. Extension’s Page You can browse a page of your extension with the protocol “chrome-extension://” chrome-extension://{extension-id}/path/to/page.html But the url is not shown in the address bar
  • 16. Override Page? A extension’s page with SPECIAL chrome url, eg: chrome://newtab/ Currently only “new tab” page can be override DO NOT make a page similar to the default “new tab” page Except more useful or faster than the default “new tab” page Otherwise DON’T override the new tab page
  • 17. Options Page? It’s just a normal extension page too But the page can be directly opened by clicking “Options” button in Extensions Management Page For saving settings of your extension only NO differences to a normal extension page
  • 18. and, Popup Page? It is also a normal extension page.
  • 19. Background tasks Or your extension doesn’t need interact with user, just do some background tasks Like Chrome WangWang Protocol Handler
  • 21. Directory Structure extension manifest.json background.htm, content_script.js _locales/ zh_CN/ messages.json en_US/
  • 22. manifest.json Core configuration file Extension name, description, logo, update url and etc. Specify the background page, content scripts, option page, actions. Permissions
  • 23. Background Page Every extension has at most ONE background page Background page is always running while Chrome is running For background tasks
  • 24. Content Scripts Toggle page action and browser action’s visibility Access the web page’s DOM
  • 26. APIs
  • 27. Chrome Extension’s API chrome.extension.* chrome.pageAction.* chrome.browserAction.* chrome.tabs.* chrome.windows.* chrome.bookmarks.* etc ...
  • 28. Asynchronous API Always use callback to get api’s return value chrome.bookmarks.getTree(function(treeNodes) { // processing bookmarks’ tree }
  • 29. Event driven Just like DOM Events chrome.pageAction.onClicked.addListener(function() { // do something }) chrome.tabs.onUpdated.addListener(function() { // do something })
  • 30. Most of the apis are ASYNCHRONOUS ASYNCHRONOUS
  • 31. Security and Sandbox Cross domain XHR is allowed “ Permission ” property in manifest.json JavaScript of Extension and web pages are running in two separated environments
  • 32. Message Passing Communications in content scripts and background page, or other extension’s page Because API limits in content scripts Encoding
  • 33. Message Passing Chrome Extension Background Page Content Scripts Page Action Browser Action Popup page, Options page, etc.
  • 34. Extension’s Resource All files of your extension is accessible Just use the protocol “chrome-extension://” Use XHR in web pages to get extension’s file
  • 35. i18n chrome.i18n.* Localized strings stored in _locales/{lang}/messages.json chrome.i18n.getMessage getMessage message name data Lookup localized string and format with data Localized string
  • 37. Package If you publish the extension on Google Official Chrome Extensions site, this step should be SKIPPED Before publishing your extension, you must package it as a “crx” file Without any other tools, Chrome is enough Protect your private key file, it’s very IMPORTANT
  • 38. Auto Updating Tell Chrome to update your extension from somewhere Be careful about “version” in manifest.json Set “update_url” in manifest.json It is NOT required if you want to publish it on Google Official Extensions site
  • 39. Publish Official Chrome Extensions Site https://chrome.google.com/extensions/developer/dashboard Note: Upload the source of you extension... Chrome Extensions http://www.chromeextensions.org/
  • 40. Resources Chrome Extension’s Documentation Google Chrome Extensions Site Chrome Extensions Source code

Editor's Notes

  • #12: 1. Use Browser Action as a useful function 2. Use a beautiful and alpha icon 3. DONT use animation