Window.opener在IE的同一个域上 [英] Window.opener null on same domain in IE

查看:338
本文介绍了Window.opener在IE的同一个域上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经广泛地研究了这个问题(有很多类似的问题),但我没有找到我想要的确切答案。

I've researched this extensively (there are many similar questions) but I'm not finding the exact answer I'm looking for.

我正在创建单一登录窗口小部件,因此用户流程如下:

I am creating a single sign-on widget, so the user flow is as follows:

登录到打开的窗口(domain1)>登录流程(domain2)>目标网页(domain1)

User clicks Login to open window (domain1) > Login flow (domain2) > Landing page (domain1)

这是我在目标网页上使用的代码:

Here is the code I'm using on the landing page:

<html>
<head>
    <title>Redirect</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <script type="text/javascript">
    if (window.opener && !window.opener.closed) {
        setTimeout(function(){
            window.opener.location.href = "[some URL]";
            window.close();
        },2000);
    }
    </script>
</head>
<body>
    <p>Logging you in...</p>
</body>
</html>

到达网页结束时的目的是为了消除跨网域问题访问window.opener。

The purpose of having the landing page at the end is so that I can eliminate cross-domain issues with accessing window.opener.

这在除IE(gasp!)之外的所有浏览器中都像一个charm。 IE说window.opener为null,即使我已经返回到我自己的域。

This works like a charm in all browsers except IE (gasp!). IE says window.opener is null, even though I have returned to my own domain.

到目前为止,我所阅读的内容并没有真正解决这个问题。我不得不认为必须有一些方法来做到这一点,因为这么多网站使用FSSO。不幸的是,我们不能选择一个弹出式窗口的替代方案。

Nothing I've read so far really solves this issue. I have to think there must be some way to do this, since so many sites are using FSSO. Unfortunately, it's not an option for us to find an alternative to a popup window.

这是不可能在IE由于浏览器相关的安全性?我唯一能想到的其他事情是在父级别上放置一些监听器来等待子级关闭。呃。

Is this just impossible to do in IE due to browser-related security? The only other thing I can think of is to put some kind of listener on the parent to wait for the child to close. Ugh.

推荐答案

似乎这个问题与我们的企业IE版本中设置的安全区域有关。不同的域被降级到不同的区域。显然,当通过这些区域时,IE会丢失window.opener的值,并且不会重置它。当测试在外部构建的IE它工作。

It seems the issue was related the security zones set on our corporate IE builds. The different domains were relegated to separate zones. Apparently IE loses the value of window.opener when passing through these zones and doesn't bother to reset it. When tested on an outside build of IE it worked.

这篇关于Window.opener在IE的同一个域上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆