在不是js打开的页面上按window.close(),会有提示框,很烦,现在可以不用了,没有提示框直接关闭窗口。


以前有人贴过利用IE5.5/6.0漏洞做的无提示窗口,

<object >

但后来ie6.0出了补丁,便失效了

现在有一种很简单的无提示关闭窗口代码如下:

IE6:
<input type="button" onClick="window.opener = 'xxx';window.close();" value="IE6无提示关闭窗口" >

<a href="#" onClick="window.opener = 'xxx';window.close();" >关闭</a>
IE7、8:
<script>
window.open('','_self');
window.close();
</script>
<input type="button" onClick="window.open('','_self');window.close();" value="IE7无提示关闭窗口" >

<a href="#" onClick="window.open('','_self');window.close();" >关闭</a>

 

IE6、IE7、FF通用代码:

<script>
window.opener=null;
window.open('','_self');
window.close();
</script>
<input type="button" onClick="window.opener=null;window.open('','_self');window.close();" value="通用无提示关闭窗口" >
<a href="#" onClick="window.opener=null;window.open('','_self');window.close();" >关闭</a>

相关文章:

  • 2022-12-23
  • 2021-09-08
  • 2021-11-19
  • 2021-10-26
  • 2021-12-25
  • 2021-10-30
  • 2021-05-21
猜你喜欢
  • 2021-12-09
  • 2021-12-16
  • 2022-03-09
  • 2021-10-26
  • 2022-03-06
  • 2021-09-19
  • 2022-02-27
相关资源
相似解决方案