jquery 获得浏览器的类型

function GetBrowserType() {
    var ua = navigator.userAgent.toLowerCase();
    if (ua == null) return "ie";
    else if (ua.indexOf('chrome') != -1) return "chrome";
    else if (ua.indexOf('opera') != -1) return "opera";
    else if (ua.indexOf('msie') != -1) return "ie";
    else if (ua.indexOf('safari') != -1) return "safari";
    else if (ua.indexOf('firefox') != -1) return "firefox";
    else if (ua.indexOf('gecko') != -1) return "gecko";
    else return "ie";
}

posted @ 2012-10-19 09:25  南潇湘  阅读(229)  评论(0编辑  收藏  举报