我尝试发布到网络商店Chrome扩展程序。 并且在chrome的开发人员区域中出现错误。 我尝试将“ activeTab”添加到清单中,但没有任何改变。
这是我的清单:
{
"name": "scan document",
"version": "1.0",
"manifest_version": 2,
"description": "scan document",
"browser_action": {
"default_icon": {
"16": "icon.png"
}
},
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["contentScript.js"],
"all_frames": true
}],
"background": {
"scripts": ["background.js"]
},
"permissions": [
"nativeMessaging"
],
"optional_permissions": [
"downloads.open",
"<all_urls>"
]
}
这是错误:
Because of the following issue, your extension may require an in-depth review:
- Broad host permissions
Instead of requesting broad host permissions, consider using the activeTab permission, or specify the sites that your extension needs access to. Both options are more secure than allowing full access to an indeterminate number of sites, and they may help minimize review times.
The activeTab permission allows access to a tab in response to an explicit user gesture.
{
...
"permissions": ["activeTab"]
}
If your extension only needs to run on certain sites, simply specify those sites in the extension manifest:
{
...
"permissions": ["https://example.com/*"]
}
我该怎么办?
答案 0 :(得分:0)
我认为当您的扩展程序要求过于一般的权限时,就会显示此错误。
在我当前编码的chrome扩展程序中,由于content_scripts的匹配,我遇到了此错误:
content_scripts": [
{
"matches": "https://*/*",
"js": ["my-script.js"]
}
]
我将https://*/*
替换为https://www.example.com/*
进行修复。
但是该脚本只能在此网站上调用。
您有相同的错误。对于您而言,由于optional_permissions all_url
,也会显示此错误"optional_permissions": [
"< all_urls>"
]