I am currently trying to write a compatibility extension for raindrop.io. Some hosts I am working with a lot require some additional fields added to the header, otherwise they reject the request. Because of this, the image preview of raindrop.io does not work properly.
Long story short, I got this working via WebRequestBlocking already for when raindrop.io is opened in the main frame. It's a rather standard issue after all. Here's the relevant code (Yes, I'm not filtering the url at all right now... I'm still experimenting)
{
"manifest_version": 2,
"name": "Referer Modifier",
"version": "1.0",
"permissions": [
"webRequest",
"webRequestBlocking",
"<all_urls>"
],
"background": {
"scripts": ["background.js"]
},
"applications": {
"gecko": {
"id": "[email protected]"
}
}
}
browser.webRequest.onBeforeSendHeaders.addListener(
function(details) {
const headers = details.requestHeaders;
/* DO HEADER MODIFICATION
It works in main frame. Not releveant for the question, so I cut it out.
*/
return {requestHeaders: headers};
},
{urls: ["<all_urls>"]},
["blocking", "requestHeaders"]
);
Again, it's basically the absolut basic example straight from documentation. It works in the main frame.
My question is... is there some way I can set this up, so it can also intercept requests made by the other extension, so that the sidebar and such work too? I tried searching through the documentation, but I'm not really deep into extension development, so I have no idea what terms I should even be looking for.