zoukankan      html  css  js  c++  java
  • js关闭浏览器窗口及检查浏览器关闭事件

    js关闭浏览器窗口,不弹出提示框。支持ie6+,火狐,谷歌等浏览器,下面以一个示例为大家详细介绍下具体的实现方法,感兴趣的朋友可以参考下
     
    js关闭浏览器窗口 

    js关闭浏览器窗口,不弹出提示框。支持ie6+,火狐,谷歌等浏览器。 
     

    <html> 
    <head /> 
    <body> 
    <script type="text/javascript"> 
    function closeWin(){ 
    window.opener=null; 
    window.open('','_self',''); 
    window.close(); 

    </script> 
    <a onclick="closeWin()" href="#">logout</a> 
    </body> 
    </html> 

    火狐默认不支持js关闭浏览器窗口,可以在about:config中将dom.allow_scripts_to_close_windows改为true。 

    js检查浏览器关闭事件 

    js检查浏览器关闭或刷新事件,主动弹出提示框。支持ie6+,火狐,谷歌等浏览器。 
     

    <html> 
    <head /> 
    <body> 
    <script type="text/javascript"> 
    window.onbeforeunload = function(){ 
    return "quit?"; 

    </script> 
    </body> 
    </html> 
  • 相关阅读:
    ssh 免密
    SCALA XML pattern attrbute(属性)
    数据库分区的概念
    Intellij IDEA 快捷键整理
    笔记--Linux
    netstat
    笔记--MySQL相关操作
    ip地址
    使用ASMCMD管理Oracle ASM
    使用RMAN执行Oracle ASM数据迁移
  • 原文地址:https://www.cnblogs.com/lenther2002/p/4821893.html
Copyright © 2011-2022 走看看