Answer the question
In order to leave comments, you need to log in
How to hide referer for two iframes on a page?
Good day.
Task:
1. Open two third-party sites in a browser window, dividing the screen into 2 halves (I think to do this through 2 iframes, if there are other ways, tell me);
2. Reduce them a little so that you can see more content on the screen (zoom: 0.8);
3. And most importantly, hide the referer for these third party sites.
I think this can be done with a chrome extension.
Can this be done? If so, point in the right direction.
Thank you.
Answer the question
In order to leave comments, you need to log in
Chrome extensions have a background page background.js
Inside this background page, you can place code that will be executed before the sites load and replace the referer header. The chrome.webRequest API will help you with this, code example for the background page:
chrome.webRequest.onBeforeSendHeaders.addListener(function(details){
var newRef = "http://referer.domain/helloworld.example";
var gotRef = false;
for(var n in details.requestHeaders){
gotRef = details.requestHeaders[n].name.toLowerCase()=="referer";
if(gotRef){
details.requestHeaders[n].value = newRef;
break;
}
}
if(!gotRef){
details.requestHeaders.push({name:"Referer",value:newRef});
}
return {requestHeaders:details.requestHeaders};
},{
urls:["http://target.domain/*"]
},[
"requestHeaders",
"blocking"
]);
"permissions" : [ "webRequest", "webRequestBlocking", "https://*.avito.ru/*" ],
"background" : { "persistent": true, "scripts": [ "background.js" ] },
{
urls:["http://target.domain/*"]
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question