所以我做了一个chrome扩展,但是“ browser_action”下的“ default_icon”对我不起作用。重新加载Chrome扩展程序后,我看不到该图标。有什么我可能会想念的吗?
manifest.json
{
"name": "New Extension",
"description" : "Base Level Extension",
"version": "1.0",
"manifest_version": 2,
"content_scripts" : [
{
"matches" : [
"<all_urls>"
],
"js" : ["content.js"]
}
],
"background":
{
"scripts" : [
"background.js"
],
"browser_action": {
"default_icon": "icon.png"
}
}
}
我在同一文件夹中有“ icon.png”,“ content.js”和“ background.js”都有2个console.log语句,它们运行良好并显示出来! < / p>
答案 0 :(得分:0)
请尝试将“ browser_action”块移到外部,以使其不嵌套在“ background”块中。
{
"name": "New Extension",
"description" : "Base Level Extension",
"version": "1.0",
"manifest_version": 2,
"content_scripts" : [{
"matches" : [
"<all_urls>"
],
"js" : ["content.js"]
}
],
"background": {
"scripts" : [
"background.js"
]
},
"browser_action": {
"default_icon": "icon.png"
}
}