Skip to content

Instantly share code, notes, and snippets.

@carlosrberto
Last active December 15, 2015 20:58
Show Gist options
  • Save carlosrberto/5321955 to your computer and use it in GitHub Desktop.
Save carlosrberto/5321955 to your computer and use it in GitHub Desktop.
A nice way to detect IE version
var ie = (function(){
var undef, v = 3, div = document.createElement('div');
while (
div.innerHTML = '<!--[if gt IE '+(++v)+']><i></i><![endif]-->',
div.getElementsByTagName('i')[0]
);
return v > 4 ? v : undef;
}());
var msie = typeof ie !== "undefined" ? true : false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment