top.location.href doesn't work in IE 8

2019-04-14 22:08发布

top.location.href doesn't work in IE8 from my facebook application when i redirect people to another URL.

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)

Anyone have any solution?

4条回答
唯我独甜
2楼-- · 2019-04-14 22:37

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

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..

查看更多
别忘想泡老子
3楼-- · 2019-04-14 22:41

Try to use window.top.location = "NEW_URL" for the IE. Or, if your code is run from iframe, parent.location = "NEW_URL"

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-04-14 22:51

top.location.href= "URL" works for me, just make sure that the URL is absolute.

查看更多
地球回转人心会变
5楼-- · 2019-04-14 22:57

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

parent.location.href = "NEW URL";

查看更多
登录 后发表回答