如何使用JavaScript关闭窗口? [英] how to close the window using javascript?

查看:205
本文介绍了如何使用JavaScript关闭窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在firefox和safari中使用javascript关闭窗口?
在IE中,以下代码有效,
但是在Firefox和Safari中不起作用?

为什么对象xmlHttpRequest消息到来?


how to close the window using javascript in firefox and safari?
In IE below code is working,
but in firefox and safari does not work?

why does object xmlHttpRequest message come?


function CloseWindow() {
     
     var windowObj = window.self;
     windowObj.opener = window.self;
     windowObj.close();

   }

推荐答案

如果您要在Google搜索中搜索window.close firefox/safari,我可能会找到解决方法.

阅读此博客文章: Mozilla firefox JavaScript window.close()不起作用/在Firefox中不起作用 [ ^ ]

这是用于Firefox的.我想给定的方法也适用于Safari.
I could have got the solution if you would done a Google search for - window.close firefox/safari.

Read this blog post: Mozilla firefox JavaScript window.close() not working / does not work in firefox[^]

This is for Firefox. I guess the methods given would work for Safari as well.


< code> document.close();</code> :-O
您可以通过< code> request.write(& lt; script language =''javascript''& gt; document.close();& lt//script& gt;"在asp.net中使用它);</code>
<code>document.close();</code> :-O
u can use it in asp.net by <code>request.write("&lt;script language=''javascript''&gt; document.close(); &lt;/script&gt;");</code>


这篇关于如何使用JavaScript关闭窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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