微信搜索superit|邀请体验:大数据, 数据管理、OLAP分析与可视化平台 | 赞助作者:赞助作者

关闭页面的时候发送请求

未分类 aide_941 2℃ 0评论
<script>

    ; (function (e) {
        e.ChangeStatus = ChangeStatus
        function ChangeStatus(url) {
            if (this instanceof ChangeStatus) {
            }
            else {
                return new ChangeStatus(url);
            }
            this.url = url;
        }
        ChangeStatus.prototype.ajax = function () {
            if (checkout) {
                checkout();
            }
            var img = Image ? new Image() : document.createElement("img");
            img.src = this.url;
        }
    }(window))
    var url = "/SaveStatus?Status=10";
    var change = new ChangeStatus(url);
    var changeStatus = $.proxy(change.ajax, change);

    window.onbeforeunload = function () {
        changeStatus();
        return "离开?"
    };
    if (window.addEventListener) {
        window.addEventListener("beforeunload", changeStatus, false);
    } else if (window.attachEvent) {
        window.attachEvent("onbeforeunload", changeStatus);
    } else {
        window["onbeforeunload"] = changeStatus;
    }

</script>

 

转载请注明:SuperIT » 关闭页面的时候发送请求

喜欢 (0)or分享 (0)

您必须 登录 才能发表评论!