简体   繁体   中英

Google Chrome Extension Running JavaScript on Load

I would like run chrome.browserAction.setBadgeText method when my popup extension loads. When I put this code on the global scope, it works only when I click on the extension button. But I would like to see the badge when Google Chrome starts. What is the method I am looking for?

Thanks

You'll want to create a background page , which can load any JavaScript you want. The background page is loaded as the browser opens, so it should be fairly trivial to make your code run at load time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM