1. 程式人生 > >獲取各瀏覽器的版本號

獲取各瀏覽器的版本號

nav like tolower agent document amp java scrip edge

browser: {
        chrome: /chrome\/(\d+\.\d+)/i.test(navigator.userAgent) ? +RegExp["\x241"] : undefined,
        firefox: /firefox\/(\d+\.\d+)/i.test(navigator.userAgent) ? +RegExp["\x241"] : undefined,
        ie: /msie (\d+\.\d+)|Trident/i.test(navigator.userAgent) ? (document.documentMode || +RegExp["\x241"]) : undefined,
        isGecko: /gecko/i.test(navigator.userAgent) && !/like gecko/i.test(navigator.userAgent),
        isWebkit: /webkit/i.test(navigator.userAgent),
        opera: /opera(\/| )(\d+(\.\d+)?)(.+?(version\/(\d+(\.\d+)?)))?/i.test(navigator.userAgent) ? +(RegExp["\x246"] || RegExp["\x242"]) : undefined,
        safari: /(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(navigator.userAgent) && !/chrome/i.test(navigator.userAgent) ? +(RegExp["\x241"] || RegExp["\x242"]) : undefined,
        isSogouIE: ((navigator.userAgent.toLowerCase()).indexOf("msie") > 0) && ((navigator.userAgent.toLowerCase()).indexOf("se") > 0) && ((navigator.userAgent.toLowerCase()).indexOf("360se") == -1),
        isBaidu: /BIDUBrowser/i.test(navigator.userAgent),
        edge: /edge\/(\d+)/i.test(navigator.userAgent) ? +RegExp["\x241"] : undefined
    }

  

獲取各瀏覽器的版本號