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();
        }
    });
与尘埃中开出花朵。
原文地址:https://www.cnblogs.com/congfeicong/p/7327494.html