Skip to content

Instantly share code, notes, and snippets.

@a-v-k
Created March 3, 2014 08:26
Show Gist options
  • Save a-v-k/9320731 to your computer and use it in GitHub Desktop.
Save a-v-k/9320731 to your computer and use it in GitHub Desktop.
Check IE version
// source from: http://stackoverflow.com/questions/5940845/how-detect-ie6-with-javascript/5940884#5940884
function getInternetExplorerVersion() {
// Returns the version of Internet Explorer or a -1
// (indicating the use of another browser).
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 );
}
return rv;
}
//And if you're a minimalist, a bit of a rebel; this method I believe actually works:
//if (typeof document.body.style.maxHeight != "undefined") {
// IE 7, moz, saf, opera 9
// } else {
// IE6, older browsers
//}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment