Created
May 2, 2016 03:18
-
-
Save stefansundin/554095418b1541fabaf5de22e5b57bd1 to your computer and use it in GitHub Desktop.
WebRequest extension test that changes the response.
This file contains hidden or 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
// 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"] | |
); |
This file contains hidden or 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
{ | |
"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