Created
September 5, 2019 07:45
-
-
Save miller45/f393c5f40e1413a85c296f23964f14dd to your computer and use it in GitHub Desktop.
get all internet explroer versions
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 getInternetExplorerVersion() | |
// Returns the version of Internet Explorer or a -1 | |
// (indicating the use of another browser). | |
// see https://msdn.microsoft.com/en-us/library/ms537509(v=vs.85).aspx | |
// but for ie 11 doenst work this way | |
{ | |
var rv = -1; // Return value assumes failure. | |
if (navigator.appName == 'Microsoft Internet Explorer') { | |
var ua = navigator.userAgent; | |
var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); | |
if (re.exec(ua) != null) | |
rv = parseFloat(RegExp.$1); | |
} else if (navigator.appName == 'Netscape') { | |
var ua = navigator.userAgent; | |
var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})"); | |
if (re.exec(ua) != null) | |
rv = parseFloat(RegExp.$1); | |
} | |
return rv; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment