Created
May 5, 2023 09:25
-
-
Save yko/9e76ee97e93fc060200f1b48a8e64a26 to your computer and use it in GitHub Desktop.
Extension demo: declarativeNetRequest.URLTransform.queryTransform.addOrReplaceParams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"description": "Showcasing declarativeNetRequest.URLTransform.queryTransform.addOrReplaceParams. Try 'https://www.example.com/search?q=test' and 'https://www.google.com/search?q=test'. With the extension installed, the url should receive the additional lr=-lang_en parameter", | |
"name": "URL Redirect", | |
"version": "0.1", | |
"manifest_version": 3, | |
"declarative_net_request" : { | |
"rule_resources" : [{ | |
"id": "test_ruleset", | |
"enabled": true, | |
"path": "ruleset.json" | |
}] | |
}, | |
"permissions": [ | |
"activeTab", | |
"declarativeNetRequest", | |
"declarativeNetRequestFeedback", | |
"declarativeNetRequestWithHostAccess" | |
], | |
"host_permissions": ["*://example.net/*", "*://*.example.net/*", "*://example.com/*", "*://*.example.com/*", "*://*.google.com/*", "https://www.google.com/search?*", "*://*/*"] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[{ | |
"id": 1, | |
"priority": 1, | |
"action": { | |
"type": "redirect", | |
"redirect": { | |
"transform": { | |
"queryTransform": { | |
"addOrReplaceParams": [{ "key": "lr", "value": "-lang_en" }] | |
} | |
} | |
} | |
}, | |
"condition": { | |
"regexFilter": "^https://www.(example|google).com/search?", | |
"resourceTypes": ["main_frame", "script"] | |
} | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment