在 IE 中调用 window.close 会抛出 null 或找不到对象错误
我在 IE 中出现了一个非常奇怪的错误。
我正在打开一个具有特定 url 的窗口,并使用以下代码立即关闭它:
openSomething(guid)
{
my_window = window.open("outlook:"+guid,"mywindow","width=0,height=0");
my_window.close();
}
此脚本按预期输出内容,即这将打开所需的正确 Outlook 邮件,但 IE 窗口显示错误“my_window null or not an object” ”。
有人可以告诉我这里出了什么问题吗?
I have a very wierd error cropping up in IE.
I am opening a window, with a specific url , and closing it immidiately, using the following code:
openSomething(guid)
{
my_window = window.open("outlook:"+guid,"mywindow","width=0,height=0");
my_window.close();
}
This script outputs things as expected, i.e this opens the right outlook mail needed, but IE window shows the error "my_window null or not an object".
Can someone please tell me what is wrong here??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当窗口被弹出窗口阻止程序阻止时,通常会发生这种情况。您需要确保
window.open
实际上返回一个窗口:That usually happens when the window is blocked by a/the popup blocker. You'll need to make sure that
window.open
actually returns a window: