dongxi7704 2013-05-30 05:15
浏览 302

为什么window.top.location不会让你退出iFrame?

I've Googled and looked over all StackOverflow questions and can't seem to find anything like this. I've got the following code here that takes a user out of the login modal and onto their homepage. Problem is, it doesn't seem to break through the modal, even though everywhere I look says window.top.location should do that. The page redirects successfully (meaning it goes to the right URL), but it redirects in the iFrame only.

echo "<script>window.top.location = '/group/$home';</script>";

Is there something else I should/could be doing to break out of the modal? Thanks in advance for your help!

  • 写回答

2条回答 默认 最新

  • dongshuobei1037 2013-05-30 05:19
    关注

    use parent

    echo "<script>window.parent.location = '/group/$home';</script>";
    
    评论

报告相同问题?