Reputation: 1183
This code doesn't work:
chrome.webRequest.onBeforeRequest.addListener(function(details){
console.log(details);
},{urls:["<all_urls>"]},['blocking']);
This code does work:
chrome.webRequest.onBeforeRequest.addListener(function(details){
console.log(details);
},{urls:["<all_urls>"]});
The question - Why the first code won't work?
Upvotes: 0
Views: 760
Reputation: 348962
The only difference between your first and second code snippet is the "blocking"
extraInfoSpec.
This suggests that you have not declared the required webRequestBlocking
permission in manifest.json
. If you want to use "blocking", then you have to add it to manifest.json
, like this:
{
...
"permissions": [
"webRequest",
"webRequestBlocking",
"webRequest"
],
...
}
This is a bug, and it has been reported at https://code.google.com/p/chromium/issues/detail?id=311511 ("Missing webRequestBlocking permission gives no warning to developers").
Upvotes: 1