js关闭当前页面

$(".close-btn").on("click", function () {
        var userAgent = navigator.userAgent;
        if (userAgent.indexOf("Firefox") != -1 || userAgent.indexOf("Chrome") != -1) {
            window.open("", "_self").close();
        } else {
            window.opener = null;
            window.open("", "_self");
            window.close();
        }
    });

 

posted @ 2017-08-09 20:19  夏天的鱼呀  阅读(881)  评论(0编辑  收藏  举报