Chrome Extension - Autorun
-
27-05-2021 - |
Question
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.
La solution
You'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:
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow