Skip to content

Instantly share code, notes, and snippets.

@stefansundin
Created May 2, 2016 03:18
Show Gist options
  • Save stefansundin/554095418b1541fabaf5de22e5b57bd1 to your computer and use it in GitHub Desktop.
Save stefansundin/554095418b1541fabaf5de22e5b57bd1 to your computer and use it in GitHub Desktop.
WebRequest extension test that changes the response.
// The subsequent requests for the videofiles fails, but it was fun to test.
// http://www.oppetarkiv.se/
// https://developer.chrome.com/extensions/webRequest
chrome.webRequest.onBeforeRequest.addListener(
function(info) {
console.log(`Intercepted ${info.url}`);
return {redirectUrl: 'data:application/json,{"inSweden":true}'};
},
{
urls: ["*://www.svtstatic.se/video/geocheck/"],
types: ["xmlhttprequest"]
},
["blocking"]
);
{
"name": "Stängt Arkiv",
"version": "1.0",
"description": "Tricks Öppet Arkiv that you are in Sweden.",
"permissions": [
"webRequest",
"webRequestBlocking",
"*://www.svtstatic.se/"
],
"background": {
"scripts": ["background.js"]
},
"manifest_version": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment