js关闭窗口兼容firefox、chrome、ie

function windowclose() {
    var browserName = navigator.appName;
    if (browserName=="Netscape") {
        window.open('', '_self', '');
        window.close();
    }
    else {
        if (browserName == "Microsoft Internet Explorer"){
            window.opener = "whocares";
            window.opener = null;
            window.open('', '_top'); 
            window.close();
        }
    } 
}

 

posted @ 2012-04-20 09:32  ghypnus  阅读(494)  评论(3编辑  收藏  举报