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.
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.
Share Improve this question asked Mar 27, 2012 at 23:24 JonJon 8,53131 gold badges95 silver badges149 bronze badges 1- See also: Chrome Extension - Auto Run a Function – Rob W Commented Mar 29, 2012 at 19:14
1 Answer
Reset to default 14You've got two options:
- Inject code as a Content scripts, using the matching rules as defined in the manifest file.
- A background page, using the
chrome.tabs.onUpdated
event. Use thechrome.tabs.executeScript
method to inject script.
See also:
- Building a Chrome extension
- Inject chrome browser extension content script based on URL