判断浏览器版本

     var idSeed = 0,

        ua = navigator.userAgent.toLowerCase(),

        check = function(r){

            return r.test(ua);

        },

        isStrict = document.compatMode == "CSS1Compat",

        isOpera = check(/opera/),

        isChrome = check(/chrome/),

        isWebKit = check(/webkit/),

        isSafari = !isChrome && check(/safari/),

        isSafari3 = isSafari && check(/version//3/),

        isSafari4 = isSafari && check(/version//4/),

        isIE = !isOpera && check(/msie/),

        isIE7 = isIE && check(/msie 7/),

        isIE8 = isIE && check(/msie 8/),

        isGecko = !isWebKit && check(/gecko/),

        isGecko3 = isGecko && check(/rv:1/.9/),

        isBorderBox = isIE && !isStrict,

        isWindows = check(/windows|win32/),

        isMac = check(/macintosh|mac os x/),

        isAir = check(/adobeair/),

        isLinux = check(/linux/),

        isSecure = /^https/i.test(window.location.protocol);

 

你可能感兴趣的:(浏览器)