Downsides of using the navigator object / user-agent sniffing for detecting IE versions
问题 With the release of jQuery 2.0, there has been a lot of talk about how to identify if the user is using an IE version which is supporting it or not (jQuery 2.0 only supports IE9 and later). My question is why a solution like this: var ie = (function(){ var undef, v = 3, div = document.createElement('div'), all = div.getElementsByTagName('i'); while ( div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->', all[0] ); return v > 4 ? v : undef; }()); is preferred over looking at the