Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction of chrome extension development

Introduction of chrome extension development

Internal sharing.

Avatar for balduran

balduran

April 22, 2016

More Decks by balduran

Other Decks in Programming

Transcript

  1. Background task A single long-running script to manage some task

    or state Only one instance is active per extension Background page or event page?? Persistent: true // it’s background page Persistent: false // it’s event page
  2. Content script Run in the context of web pages Can

    read details of the web pages the browser visits, or make changes to them Multiple instance(1 per tab) per extension Cannot call some chrome.* API Cannot access variables/functions defined by web pages
  3. Development/testing 1. Create project 2. Write codes 3. Load extension

    4. test/debug feature 5. Upload to chrome web store
  4. chrome.* API Three groups User interface Browser action, page action

    Control browser Windows, tabs, bookmakrs, history, cookies Communicate with server Content script, XHR
  5. Chrome.runtime API retrieve the background page, return details about the

    manifest, and listen for and respond to events in the app or extension lifecycle
  6. Chrome.activeTab API interact with the browser's tab system executeScript Injects

    JavaScript code into a page insertCSS Injects CSS into a page