JavaScript无提示关闭当前页面窗口,兼容IE/Firefox/Chrome (Close the current page window without confirm by JavaScript, support all browsers)
在IE7/ Firefox 3.0/ Google Chrome通过测试
CloseDemo.htm
复制代码 代码如下:

<script>
var browserName=navigator.appName;
if (browserName=="Netscape")
{
function closeme()
{
window.open('','_parent','');
window.close();
}
}
else
{
if (browserName=="Microsoft Internet Explorer")
{
function closynoshowsme()
{
window.opener = "whocares";
window.close();
}
}
}
</script>
<input type="button" value="close me 3" onclick="closeme();"/>

注意“
如果你使用的是firefox浏览器必须要做以下设置
1、在地址栏输入about:config然后回车,警告确认
2、在过滤器中输入”dom.allow_scripts_to_close_windows“,双击即可将此值设为true
即可完成了
详细出处参考:http://www.jb51.net/article/16572.htm

相关文章:

  • 2022-12-23
  • 2021-10-30
  • 2022-01-02
  • 2021-07-01
  • 2021-10-27
  • 2022-12-23
  • 2021-09-19
  • 2021-05-19
猜你喜欢
  • 2021-05-20
  • 2021-06-10
  • 2022-02-07
  • 2022-12-23
  • 2021-10-23
相关资源
相似解决方案