使用window.close()关闭当前窗口

编程入门 行业动态 更新时间:2024-10-26 00:28:19
本文介绍了使用window.close()关闭当前窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

当我想在IE6.0中使用window.close()关闭当前窗口时, 会有一个确认框:网页您正在查看的页面正在尝试 关闭窗口。你要关闭这个窗口吗? 我必须单击是关闭窗口。 如果没有此对话框,如何直接关闭当前窗口? 谢谢。

Hi, When I want to close the current window using window.close() in IE6.0, there will be a confirm box that: The web page you are viewing is trying to close the window. Do you want to close this window? I have to click yes to close the window. How can I close the current window directly without this dialog box? Thank you.

推荐答案

希望这会有所帮助: = ================ window.opener = self; window.close(); ================= ..Andrew Hope this helps: ================= window.opener = self; window.close(); ================= ..Andrew

只有当只有一个窗口并且不能关闭时才会出现此警报。 This alert occurs only if there is only one window and cannot be switched off.

您确定吗? 我想这可能与安全有关,但方法不明确 足够。 下面臭名昭着的代码确实如此在Firefox中不起作用:)) ========== < html> < ; body onclick =" alert(''ooops''); window.opener =自我; window.close();"> 点击此页面并调用window.close()。 < / body> < / html> ========= 尽管如此,我已经在Opera和IE中检查过,两者都成功了。 Are you sure? I guess it could be security-dependent, but the approach is not clear enough. The notorious code below does not work in Firefox :)) ========== <html> <body onclick="alert(''ooops''); window.opener=self; window.close();"> Click this page and window.close() is called. </body> </html> ========= Nevertheless, I''ve checked it in Opera and IE, both succeeded.

更多推荐

使用window.close()关闭当前窗口

本文发布于:2023-11-09 15:31:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1572736.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:窗口   window   close

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!