开发者

Google Chrome Extension Running JavaScript on Load

开发者 https://www.devze.com 2023-03-05 18:32 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消