码迷,mamicode.com
首页 > Web开发 > 详细

js 监控浏览器关闭事件

时间:2016-07-12 13:36:56      阅读:361      评论:0      收藏:0      [点我收藏+]

标签:

代码如下:

<!DOCTYPE html>
<html>
    <head>
        <title>监控浏览器关闭事件</title>
    </head>
    <style type="text/css">
    </style>
    <body>
        <div id="create_order">
        </div>
    </body>
</html>
<script type="text/javascript">
    var widowClose = {};
    widowClose.tip = "浏览器即将关闭,是否确定??";
    widowClose.set = function(a) {
        window.onbeforeunload = function(b) {
            b = b || window.event;
            b.returnValue = a;
            return a
        }
    };
    widowClose.clear = function() {
        fckDraft.delDraftById();
        window.onbeforeunload = function() {
        }
    };
    widowClose.set(widowClose.tip);
</script>

 

js 监控浏览器关闭事件

标签:

原文地址:http://www.cnblogs.com/shizhouyu/p/5663136.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!