function ieVersion(uaString) { // Returns IE version number, or undefined uaString = uaString || navigator.userAgent; var match = /\b(MSIE |Trident.*?rv:|Edge\/)(\d+)/.exec(uaString); if (match) return parseInt(match[2]) }