My first post here. Please forgive me, if I make something wrongly.
I'm working on a Chrome extension to block images from web pages. I realize this with chrome.declarativeNetRequest to add rules with something like this:
{
"action": {
"type": "redirect",
"redirect": {
"extensionPath": "/a.jpg"
}
},
"condition": {
"urlFilter": "*",
"resourceTypes": ["image", "media"]
}
}
This fails because of a "strict-origin-when-cross-origin" problem in Chrome 103. If I'm right, Chrome does not allow me to redirect to a Chrome extension image.
But it's allows a redirect to a third party domain with:
{
"action": {
"type": "redirect",
"redirect": {
"url": "
https://upload.wikimedia.org/wikipedia/commons/c/ca/1x1.png"
}
},
"condition": {
"urlFilter": "*",
"resourceTypes": ["image", "media"]
}
}
Why it's not allowed to redirect into an extension resource, but into a third party domain. Imho, extension should be more trustful than other domains.
Is this a bug in Chrome?
And what is the sense to implement "extensionPath", if it's doesn't work?
The documentation of it is available here:
https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#type-Redirect