在注入腳本中使用命令Chrome擴展注入腳本得到錯誤
chrome.tabs.executeScript(
null, {file: "dialog.js"});
拋出錯誤
未選中runtime.lastError在運行tabs.executeScript:無法訪問URL的「鉻devtools內容:/ /devtools/bundled/inspector.html?& remoteBase = https://chrom ... om/serve_file/@ 4fc366553993dd1524b47a280fed49d8ec28421e/& dockSide = undocked「。擴展清單必須請求訪問此主機的權限。 在onNativeMessage(鉻 - 延伸://knldjmfmopnpolahpmmgbagdohdnhkik/background.js:31:5)
manifiest.json
{
"key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcBHwzDvyBQ6bDppkIs9MP4ksKqCMyXQ/A52JivHZKh4YO/9vJsT3oaYhSpDCE9RPocOEQvwsHsFReW2nUEc6OLLyoCFFxIb7KkLGsmfakkut/fFdNJYh0xOTbSN8YvLWcqph09XAY2Y/f0AL7vfO1cuCqtkMt8hFrBGWxDdf9CQIDAQAB",
"name": "TerminusProLink",
"version": "1.0",
"manifest_version": 2,
"description": "Link to ProLaw App",
"background": {
"scripts": [ "background.js", "background.html"]
},
"content_scripts": [
{
"all_frames": true,
"js": [ "jquery-1.5.1.js", "jquery-ui-1.8.11.js", "content.js" ],
"matches": [ "http://*/*", "https://*/*" ]
}
],
"permissions": [
"background", "tabs", "http://*/*", "https://*/*",
]
}
任何具有一個溶液請建議。
添加
"web_accessible_resources": ["dialog.js"]
順便說一句,你可以趕上lastError:https://stackoverflow.com/a/45603880/632951 – Pacerier