小编Yar*_*lav的帖子

未选中的runtime.lastError:无法访问url“”的内容。扩展清单必须请求访问此主机的权限。在清单3中

请帮帮我!我收到错误Unchecked runtime.lastError: Cannot access contents of url. Extension manifest must request permission to access this host.并且Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.我在 google chrome 清单 3 中

来自内容脚本的监听器

chrome.runtime.onMessage.addListener(
function(req, sender, sendResponse) {
    if(req.msg === "analysis background") {
        let obj = parse();
        sendResponse(obj);
    }
        
    return true;
}
); 
); 
Run Code Online (Sandbox Code Playgroud)

清单.json

{
    "manifest_version": 3,
    "name": "extensionParser",
    "version": "1.0.0",
    "action": { 
        "default_popup": "popups/popup.html"
      },
    "background": {
        "service_worker": "background.js"
    },
    "permissions": ["tabs", "scripting",
        "http://localhost/site_for_parsing"]
} …
Run Code Online (Sandbox Code Playgroud)

javascript google-chrome-extension manifest.json

6
推荐指数
1
解决办法
6683
查看次数