javascript top.location.href 在 IE 8 中不起作用
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6712528/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
top.location.href doesn't work in IE 8
提问by Simon Thomsen
top.location.href
doesn't work in IE8 from my facebook application when i redirect people to another URL.
top.location.href
当我将人们重定向到另一个 URL 时,我的 facebook 应用程序在 IE8 中不起作用。
Anyone have any other solution to redirect a user to another URL (It's need to redirect the URL outside the iframe, in this case the apps.facebook.com/application
URL and not my domain URL)
任何人都有任何其他解决方案将用户重定向到另一个 URL(需要将 URL 重定向到 iframe 之外,在这种情况下是apps.facebook.com/application
URL 而不是我的域 URL)
Anyone have any solution?
有人有任何解决方案吗?
回答by VMAtm
Try to use window.top.location = "NEW_URL"
for the IE. Or, if your code is run from iframe
, parent.location = "NEW_URL"
尝试window.top.location = "NEW_URL"
用于IE。或者,如果您的代码是从iframe
,parent.location = "NEW_URL"
回答by mp3duck
Fairly old post, but I'd thought I'd share the solution that worked for me:
相当老的帖子,但我想我会分享对我有用的解决方案:
I found that when in an iFrame (within a Facebook Tab), I had to use
我发现在 iFrame(在 Facebook 标签中)时,我不得不使用
parent.location.href= "NEW URL";
父位置。href= "新网址";
回答by Wouter Meeuwisse
I had the same problem and you would not believe what the error was... i added a line in de dsk of facebook (facebook.php)! I downloaded the latest version, but i think it wasn't updated since Auth2.0
我遇到了同样的问题,你不会相信错误是什么......我在 facebook (facebook.php) 的 de dsk 中添加了一行!我下载了最新版本,但我认为它自 Auth2.0 以来没有更新
Wrong:
错误的:
protected static $DROP_QUERY_PARAMS = array(
'code',
'state',
'signed_request',
);
Right:
对:
protected static $DROP_QUERY_PARAMS = array(
'code',
'state',
'signed_request',
'base_domain',
);
The redirect was only not working in IE, after this modification it worked..
重定向仅在 IE 中不起作用,在此修改后它起作用了..
回答by aelnawawy
top.location.href= "URL"
works for me, just make sure that the URL is absolute.
top.location.href= "URL"
对我有用,只需确保 URL 是绝对的。