unc*_*bob 6 google-chrome-extension
我正在 Chrome 中构建一个扩展,但如果我不打开插件的调试模式,它总是处于非活动状态,这会导致当我进入目标页面时插件无法工作,例如:dms.mydomain-inc.com
当我访问注册页面时如何使其永久有效manifest.json
?这是我的manifest.json
{
"name": "Tool for test",
"description": "Build an Extension!",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js",
"persistent": true
},
"options_page": "options.html",
"permissions": ["storage",
"activeTab",
"scripting",
"webRequest"],
"host_permissions": [
"*://*.mydomain.vn/*",
"*://dms.mydomain-inc.com/",
"wss://news.mydomain-inc.com/"
],
"content_scripts": [
{
"matches": ["*://news.mydomain-inc.com/"],
"css": ["css/style.css"],
"js": ["contentScript.js", "jquery-3.5.1.min.js"]
}
],
"action": {
"default_popup": "popup.html",
"default_icon": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
},
"icons": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢
开发清单版本 3 扩展是很正常的事情。Chrome 正在成为一款轻量级浏览器,部分原因在于用户安装了数十种扩展程序。因此,Google 在扩展中引入了 Service Worker,以便尽可能释放一些内存。SW 在必要时被激活,然后进入睡眠状态,直到它被唤醒以执行新的工作。
说了这句话,
归档时间: |
|
查看次数: |
4904 次 |
最近记录: |