[英]Make Google Chrome Extension disabled by default
I want to make my Google Chrome Extension disabled by default and then enable it based on the content flow , how could I achieve it ?我想默认禁用我的 Google Chrome 扩展程序,然后根据内容流启用它,我该如何实现?
Here is the API to make the extension disabled , I need that by default .这是禁用扩展的 API,默认情况下我需要它。 https://developer.chrome.com/extensions/browserAction#method-disable
https://developer.chrome.com/extensions/browserAction#method-disable
In your background page (as configured in manifest.json
eg):在您的后台页面中(如
manifest.json
配置,例如):
"background": {
"scripts": [
"js/background.js"
]
}
You can do the following to disable the extension each time a tab is opened::您可以执行以下操作以在每次打开选项卡时禁用扩展:
chrome.tabs.onCreated.addListener(() => {
chrome.browserAction.disable();
});
Then later, based on flow call chrome.browserAction.enable();
后来,基于流程调用
chrome.browserAction.enable();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.