页面点击关闭事件

        <script type="text/javascript">  
       window.onbeforeunload = function() //author: meizz     
    {     
           var n = window.event.screenX - window.screenLeft;     
           var b = n > document.documentElement.scrollWidth-20;     
           if(b && window.event.clientY < 0 || window.event.altKey)     
           {     
                 // alert("是关闭而非刷新");  
                  window.location.href="${pageContext.request.contextPath}/jsonlogin/logout.action";
                 // window.event.returnValue = ""; //这里可以放置你想做的操作代码     
           }     
    }
       </script>

你可能感兴趣的:(页面点击关闭事件)