这是我的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
的所有请求。但是,我想阻止对所有网站的请求。我尝试用://facebook.com/
和<all_urls>
替换://*/*
无效。有谁知道解决方案?