简体   繁体   English

IE9 window.opener问题

[英]IE9 window.opener problem

I have a window A , A will pop a window we called B , B will submit data to server, and then redirect B to domain same with A . 我有一个窗口AA将弹出一个称为B的窗口, B会将数据提交到服务器,然后将B重定向到与A相同的域。

My question is at the last step,seems when the server does 302 redirect, the window object in B will lost the opener property under IE. 我的问题是在最后一步,似乎服务器进行302重定向时, B的窗口对象将丢失IE下的opener属性。 how do i solve it? 我该如何解决? thanks for advice 谢谢你的建议

Update: 更新:

What i want to do is, when B redirect back to the same domain as A, B will transfer some data to A . 我想做的是,当B重定向回与A相同的域时, B会将一些数据传输到A I must use 'B'.opener to get a reference of A . 我必须使用'B'.opener来获取A的引用。 It works as expected in chrome but not in IE. 它在chrome中可以正常工作,但在IE中却无法正常工作。

I solved it by myself, to approach that. 我自己解决了这个问题。 I did the following step: 我做了以下步骤:

  1. Store a reference of B when B pops up in A 当B在A中弹出时,存储B的参考

  2. Set a timer in A keep tracking if B's location is readable and the domain is same with A 在A中设置一个计时器,以跟踪B的位置是否可读并且该域与A相同

  3. If B's location.host is readable and same with a again, read the value then close B 如果B的location.host可读且与a相同,则读取值,然后关闭B

I found the same question (maybe) on my test site with IE9. 我在使用IE9的测试站点上发现了相同的问题(也许)。 but it's running correctly on my production site with the same code. 但它在我的生产站点上使用相同的代码即可正确运行。

And I found that if A and B are running with different IE security settings (in my case A is local network, B is internet ) , it will cause this problem. 而且我发现,如果A和B使用不同的IE安全设置运行(在我的情况下A是本地网络,B是internet),则将导致此问题。

If I change IE security settings, let A became to internet settings, no this problem any more. 如果我更改IE安全设置,则让A成为Internet设置,不再存在此问题。

I enabled "Protected Mode" in "Local intranet" settings of the internet explorer (Tools->Internet Options), and worked perfectly. 我在Internet Explorer的“本地Intranet”设置(工具-> Internet选项)中启用了“保护模式”,并且运行良好。

Regards, Alvaro. 问候,阿尔瓦罗。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM