本文介绍了Javascript window.opener在IE 10中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个可打开弹出窗口的插件.在此弹出窗口内,我有一个链接可以关闭我的弹出窗口并重定向父级网址,例如:

I've developed a plugin that open a pop up. Inside this pop up i have a link that clos my pop up and redirect the url of the parent, like this :

window.parent.opener.location = "http://google.fr";
or
window.opener.location =     "http://google.fr";

两个都可以,但是在某些版本的IE中却不能.我的父页面不在我的子页面的同一域中,但是即使是这种情况,它仍然无法正常工作.IE在底部显示一条消息,询问是否要让网站执行此操作.我想知道是否有一种方法可以强制IE在不降低安全性的情况下默认执行该操作.谢谢.

Both are working but in some versions of IE, they don't. My parent page isn't on the same domain of my children page, but even when it is the case, it still doesn't work.IE puts a message at the bottom asking if I want to let the website do this.I'd like to know if there is a way to force IE to do it by default, without decreasing the security.Thanks.

推荐答案

window.opener在默认安全级别下无法在IE中工作.

window.opener won't work in IE under default security level if the child window is from a different domain..

一种选择是使用location.href将子窗口重定向到与父窗口相同的域中的页面,然后使用window.opener

An option is to use location.href to redirect the child window to a page in the domain same as the parent window and then use window.opener

这篇关于Javascript window.opener在IE 10中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 11:28