Skip to content

Instantly share code, notes, and snippets.

@gerasimua
Created August 14, 2014 17:46
Show Gist options
  • Save gerasimua/59279fdd37855b3c2c5e to your computer and use it in GitHub Desktop.
Save gerasimua/59279fdd37855b3c2c5e to your computer and use it in GitHub Desktop.
IE version
function getInternetExplorerVersion()
{
var rv = -1;
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