在 IE9 上,Win 7 window.open() 返回 null 而不是打开窗口的引用 [英] On IE9, Win 7 window.open() returns null instead of reference of the opened window

查看:64
本文介绍了在 IE9 上,Win 7 window.open() 返回 null 而不是打开窗口的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试类似下面的内容,

var myWindow = null;if(!myWindow || myWindow.closed){myWindow = window.open(url, windowId);}别的{myWindow.focus();}

所有浏览器都返回 window.open() 的窗口引用,但 IE 9 返回 NULL.有没有人有更多关于为什么返回 null 的信息或可能的 IE9 解决方案?

解决方案

window.open 如果在 Internet 下选中 Enable Protected Mode,则返回 NULL 引用对象Options->Security->Security Level for this zone 和 ZONE 是不同的,即在我的例子中本地文件从 Intranet 打开一个弹出窗口.

window.open 返回参考对象,即使当 mysite.com 在弹出窗口(即 Internet->Internet)中打开 someothersite.com 时选中 启用保护模式>

I am trying something like below,

var myWindow = null;
if(!myWindow || myWindow.closed)
{
    myWindow = window.open(url, windowId);
}
else 
{
    myWindow.focus();   
}

All browsers return the window ref for window.open(), but IE 9 returns NULL. Does anybody have more information on why null is returned or possibly a workaround solution for IE9?

解决方案

window.open returns a NULL reference object if Enable Protected Mode is checked under Internet Options->Security->Security Level for this zone and the ZONE is different i.e. in my case local file opening a popup from Intranet.

window.open returns a reference object even if Enable Protected Mode is checked when mysite.com opens someothersite.com in popup window i.e. Internet->Internet

这篇关于在 IE9 上,Win 7 window.open() 返回 null 而不是打开窗口的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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