目标是将内容脚本注入Google Chrome扩展程序中的eventpage脚本,而不会在单击按钮时弹出菜单。当前错误消息是
tabs.executeScript: Cannot access a chrome:// URL
在content_script中提取了一个获取请求,如果您对此有任何提示,我们将不胜感激。
chrome.browserAction.onClicked.addListener(function (tab) {
chrome.tabs.executeScript(null, {file: "content_script.js"});
});
{
"manifest_version": 2,
"name": "Seneca One add Bookmark",
"description": "Posts URL to database.",
"version": "2.0",
"background": {
"scripts": ["eventPage.js"],
"persistent": false
},
"browser_action": {
"default_icon": "Favicon@2x.png",
"default_title": "Add bookmark"
},
"content_scripts": [
{
"matches": ["http://*/*"],
"js": ["content_script.js"]
}
],
"permissions": [
"activeTab",
"storage",
"tabs",
"http://*/*",
"https://*/*"
]
}
答案 0 :(得分:0)