获取各浏览器的版本号

1
2
3
4
5
6
7
8
9
10
11
12
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
}