最终目标是检查标签url,如果匹配则在徽章中显示消息或警报,但是在chrome.browserAction中变得不确定,而在我的background.js中则是偶数。浏览了几篇文章,但无法解决该错误。
background.js
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo,tab) {
chrome.browserAction.setPopup({"tabId":tabId,"popup": "popup.html"});
});
Manifest.json
{
"name": "",
"version": "1.0",
"description": "Extension for",
"permissions": ["tabs","activeTab", "declarativeContent", "storage","identity","identity.email"],
"options_page": "options.html",
"background": {
"scripts": ["background.js"],
"persistent": false,
"browser_action": {
"default_popup": "popup.html"
}
},
"page_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"
},
"manifest_version": 2,
"content_scripts": [{
"matches": ["<all_urls>"],
"js": ["popup.js"]
}]
}