Skip to content

Instantly share code, notes, and snippets.

@ncla
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ncla/4eb294fce065fb7bfc25 to your computer and use it in GitHub Desktop.
Save ncla/4eb294fce065fb7bfc25 to your computer and use it in GitHub Desktop.
Chrome webRequest - Change 'Location' header
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