Created
February 20, 2019 10:55
-
-
Save rkotze/5df52aa568aa696962e9927a0c92041b to your computer and use it in GitHub Desktop.
Detect if Internet Explorer and return the version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function detectIE(){ | |
var IE = navigator.userAgent.match(/MSIE\s([0-9]+)\./); | |
if(IE) return parseInt(IE[1], 10); | |
var IE11 = navigator.userAgent.match(/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/); | |
if(IE11) return parseInt(IE11[1], 10); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment