3

I am wondering if it is possible to automatically run my extension (or a function in my extension) each time a page loads? Right now, I have it set that you would click the icon Browser Action icon to run my extension.

Jon
  • 8,205
  • 25
  • 87
  • 146
  • See also: [Chrome Extension - Auto Run a Function](http://stackoverflow.com/a/9916089/938089?chrome-extension-auto-run-a-function) – Rob W Mar 29 '12 at 19:14

1 Answers1

14

You've got two options:

  1. Inject code as a Content scripts, using the matching rules as defined in the manifest file.
  2. A background page, using the chrome.tabs.onUpdated event. Use the chrome.tabs.executeScript method to inject script.

See also:

  1. Building a Chrome extension
  2. Inject chrome browser extension content script based on URL
Community
  • 1
  • 1
Rob W
  • 341,306
  • 83
  • 791
  • 678