这是我的manifest.json

{
    "manifest_version": 2,
    "name": "Resource Blocker",
    "description": "Blocks resources loading from websites.",
    "version": "1.0",

    "background": {
        "scripts": ["main.js"]
    }, 

    "permissions": [
    "tabs", "http://*/*", "https://*/*", "webRequest", "webRequestBlocking"
    ]
}

这是main.js

chrome.webRequest.onBeforeRequest.addListener(
        function(details) {
          return {cancel: details.url.indexOf("://www.facebook.com/") != -1};
        },
        {urls: ["<all_urls>"]},
        ["blocking"]);

显然,这阻止了对facebook.com所有请求。 但是,我想阻止对所有网站的请求。 我尝试用<all_urls>://*/*替换://facebook.com/无济于事。 有人知道解决方案吗?

  ask by foobar1209 translate from so

本文未有回复,本站智能推荐: