扑捉浏览器关闭事件

来源:互联网 发布:软件开发预算方案 编辑:程序博客网 时间:2024/04/28 12:50

<script for="window" event="onbeforeunload">
var n = window.event.screenX - window.screenLeft;
    var b = n > document.documentElement.scrollWidth-20;
    //document.body.clientWidth-event.clientX<15
if (b&&event.clientY< 0||event.altKey)
{
   top.location.href="exit.jsp";//当浏览器关闭时,执行exit.jsp页面
     //window.event.returnValue="关闭窗口将停止所有会话!";
   //window.event.returnValue=""; 页面提示
}    
</script>

原创粉丝点击