当我在本地加载我的 chrome 应用程序时,我没有任何问题。在它还完全功能发布之前,但我不得不稍微更新代码,现在我收到一个错误,我根本找不到(或任何甚至有相同问题的资源)的来源。
我收到的错误消息是
安装错误:包无效。信息:“无法加载背景脚本“back.js”。”。
清单文件:
{
"name": "x",
"version": "1.1.332",
"manifest_version": 2,
"background": {
"scripts": ["back.js"]
},
"permissions": ["https://redacted.com/*", "http://www.redacted.com/manual.php",
"tabs", "storage", "webNavigation"],
"browser_action": {}
}
back.js 看起来像这样:
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(tab.id,{file: "magic.js"});
info
var newURL = "http://www.redacted.php"; chrome.tabs.create({ url: newURL });
});
chrome.webNavigation.onCompleted.addListener(function(tab) {
chrome.tabs.executeScript(tab.id,{file: "targetPage.js"}); }, {url: [{urlMatches : 'http://www.redacted.php'}]});
我将 .crx 文件与清单文件一起压缩并上传。