Last active
August 29, 2015 14:06
-
-
Save ncla/4eb294fce065fb7bfc25 to your computer and use it in GitHub Desktop.
Chrome webRequest - Change 'Location' header
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
chrome.webRequest.onHeadersReceived.addListener( | |
function(details) { | |
var headers = details.responseHeaders, | |
blockingResponse = {}; | |
var originalURL = details.url; | |
for(var i = 0, l = headers.length; i < l; ++i) { | |
/* | |
That's right. | |
I did it this way. | |
What you gonna do now? | |
*/ | |
if(headers[i].name == 'Location' && headers[i].value.indexOf("/wait.html") != -1) { | |
headers[i].value = originalURL; | |
break; | |
} | |
} | |
blockingResponse.responseHeaders = headers; | |
return blockingResponse; | |
}, | |
{urls: ["*://csgolounge.com/*", "*://dota2lounge.com/*"]}, | |
["responseHeaders", "blocking"] | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment