【发布时间】:2016-06-29 14:17:48
【问题描述】:
似乎每次刷新都会触发我的 background.js [植入警报,每次刷新我都会看到它,而且我的上下文菜单正在复制其内部自我]。
这是我的清单文件:
"manifest_version": 2,
"name": "test",
"description": "test",
"version": "1.0",
"permissions": [
"activeTab",
"storage",
"tabs",
"contextMenus",
"https://*/*",
"http://*/*",
"https://www.google.com/_/chrome/newtab*"
],
"browser_action": {
"default_icon": "raj_robot.png",
"default_title" : "MemoMi"
},
"chrome_url_overrides" : {
"newtab" : "mypage.html"
},
"background": {
"scripts" : ["background.js"]
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js" : ["selection.js"],
"run_at": "document_end"
}
],
这是我的后台脚本:
function handle_click() {
alert("hi there!");
}
chrome.contextMenus.create({
title: "menu title",
contexts:["selection"],
onclick: handle_click
});
我在这里做错了什么?
谢谢! 古拉
【问题讨论】:
-
您的后台脚本中有什么?此外,您的内容脚本,因为(IIRC)这是唯一应该刷新的脚本。
-
已添加到问题中。谢谢
标签: google-chrome plugins google-chrome-extension google-chrome-devtools google-chrome-app