Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Forked from jashkenas/wait-google-sent-me.js
Last active August 29, 2015 14:21
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save miguelmota/ba322576f7aa5708b82b to your computer and use it in GitHub Desktop.
var active = false;
function changeRefer(details) {
if (!active) return;
for (var i = 0; i < details.requestHeaders.length; ++i) {
if (details.requestHeaders[i].name === 'Referer') {
details.requestHeaders[i].value = 'http://www.google.com/';
break;
}
}
active = false;
return {requestHeaders: details.requestHeaders};
}
chrome.webRequest.onBeforeSendHeaders.addListener(changeRefer, {
urls: ["<all_urls>"],
types: ["main_frame"],
}, ["requestHeaders", "blocking"]);
chrome.browserAction.onClicked.addListener(function(tab) {
active = true;
chrome.tabs.executeScript({
code: 'window.stop(); window.location.reload();'
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment