79600810

Date: 2025-04-30 17:17:40
Score: 0.5
Natty:
Report link

Thanks to @woxxom who nudged me in the right direction. The solution is to use runtime.getURL() as "initiatorDomains".

let url = chrome.runtime.getURL("").split("/").filter(a => a != "");
let id = url[url.length - 1];
let rule = 
[{
    "id": 1,
    "priority": 1,
    "action": {
        "type": "modifyHeaders",
        "requestHeaders": [{ "header": "origin", "operation": "remove" }]
    },
    "condition": { "urlFilter" : "example.com", "initiatorDomains": [id]}
}];

This solution works in chrome and firefox.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Whitelisted phrase (-1): solution is
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: gamebeaker