I have a chrome extension,
I am trying to catch webRequest for example onBeforeRequest, but it doesn't fire on some web requests. Is it even possible to not have a onBeforeRequest fired on some http or https website? or I am confusing the url patterns somewhere?
This is the code in background.js. beforeRequest is never executed on some websites. Not if I try on this website for example: https://discourse.mozilla.org/t/onbeforerequest-event-not-fired-firefox-is-started-with-command-line-options/33557
Is it possible that url patterns
"<all_urls>" or "*://*/*"
don't match with the URL?
chrome.webRequest.onBeforeRequest.addListener(
function(details){
beforeRequest(details.tabId);
}, {urls: ["<all_urls>"],types: ["main_frame"]}, [ "blocking" ]);
This is the manifest.json
{
"name": "Example",
"version": "1.0",
"manifest_version": 2,
"description": "Prototype",
"browser_action": {
"default_icon": "img/grey-16.png",
"default_popup": "popup/index.html"
},
"permissions": [
"tabs",
"background",
"<all_urls>",
"activeTab",
"webRequest",
"webRequestBlocking",
"storage",
"downloads",
"webNavigation"
],
"content_scripts" : [
{
"js": ["content_scr.js"],
"run_at": "document_start",
"all_frames" : true,
"matches": ["*://*/*"]
}
],
"background": {
"scripts" : ["background.js"],
"persistent": true
},
"content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'"
}