现在的位置: 首页 > 综合 > 正文

js判断浏览器

2013年01月09日 ⁄ 综合 ⁄ 共 401字 ⁄ 字号 评论关闭

 

function CheckBrowser(){

    var cb = "Unknown";

    if(window.ActiveXObject){

        cb = "IE";

    }else if(navigator.userAgent.toLowerCase().indexOf("firefox") != -1){

        cb = "Firefox";

    }else if((typeof document.implementation != "undefined") && (typeof document.implementation.createDocument != "undefined") && (typeof HTMLDocument != "undefined")){

        cb = "Mozilla";

    }else if(navigator.userAgent.toLowerCase().indexOf("opera") != -1){

        cb = "Opera";

    }

    return cb;

}

抱歉!评论已关闭.