最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Chrome Extension - Autorun - Stack Overflow

programmeradmin4浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 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
发布评论

评论列表(0)

  1. 暂无评论