问题
I have following code:
chrome.webRequest.onBeforeRequest.addListener(
function(details) {
return { redirectUrl: "http://yahoo.com"};
},
{
urls: [
'http://google.com'
],
types: ['main_frame']
},
['blocking']);
This is redirecting google.com to yahoo.com.
My Question is now howto keep google.com
in the addressbar, showing yahoo.com.
My first attempt was to use
chrome.tabs.update(tab.id, {url: details.url});
but that results in an Reloading of the site.
WHY?
I am requesting this for pdf.js, since its anoying to loose the PDF URL.
回答1:
This is not possible, you may simulate this effect by using a 100%x100% frame - but still, your question sounds very malicious.
来源:https://stackoverflow.com/questions/15359042/change-url-on-onbeforerequest