更改onBeforeRequest的URL [英] Change URL on onBeforeRequest
问题描述
我有以下代码:
chrome.webRequest.onBeforeRequest.addListener(
function(details){
return {redirectUrl:http://yahoo.com};
},
{
网址:[
'http:// google .com'
],
类型:['main_frame']
},
['blocking']);
这会将google.com重定向到yahoo.com。
我的问题是现在如何在地址栏中保留 google.com
,显示yahoo.com。
我的第一次尝试是使用
chrome.tabs.update(tab.id,{url:details.url});
$ b
但导致网站重新加载。
为什么?
我要求 pdf.js ,因为它讨厌松动PDF URL。 / div>
这是不可能的,你可以通过使用100%x100%的框架来模拟这种效果 - 但仍然,你的问题听起来非常恶意。
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.
This is not possible, you may simulate this effect by using a 100%x100% frame - but still, your question sounds very malicious.
这篇关于更改onBeforeRequest的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!