关闭浏览器窗口的兼容性写法

function windowClose(){//关闭浏览器窗口
    if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") !=-1) {
        window.location.href="about:blank";
        window.close();
    } else {
        window.opener = null;
        window.open("", "_self");
        window.close();
    }
}

 

posted @ 2020-02-27 19:51  古墩古墩  Views(249)  Comments(0Edit  收藏  举报