google-chrome

Chrome Extensions

Remarks#

Google Chrome supports extensions that augment the way the browser works. They can add functionality to web pages or to the browser UI.

Browser Action running executeScript on a page.

manifest.json

{
  "name": "Hello Page",
  "description": "Add 'Hello' to the current page.",
  "version": "1.0",
  "permissions": [
    "activeTab"
  ],
  "background": {
    "scripts": ["background.js"],
    "persistent": false
  },
  "browser_action": {
    "default_title": "Say Hello on this page"
  },
  "manifest_version": 2
}

background.js

chrome.browserAction.onClicked.addListener(function(tab) {
  chrome.tabs.executeScript({
    code: 'document.body.insertAdjacentText("beforeBegin", "Hello!")'
  });
});

This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow