Browser detection has been attacked for many years as being a bad idea. Using feature detection instead is the much more preferred technique.
That's not browser detection. It's using IE conditional comments. I just can't tell how to fire it.
Ahh yes, conditional comments. Those aren't being used from IE10 onwards.
We have details on them at [http://www.sitepoint.com/microsoft-drop-ie10-conditional-comments/](Microsoft Drop Conditional Comments in IE10)
And you can see the IE page about them at Microsoft's About conditional comments
If you're asking about how the code from the OP works, it's just adding an <I> element to the web page. The conditional comment will result in it being visible to the DOM when the IE version is greater than the specified number, at which point it can tell what version of IE is being used.
I would stay away from such techniques though, due to the bad browser detection paradigm, and that it fails when conditional comments aren't supported, which applies to IE 10 and onwards.
This topic is now closed. New replies are no longer allowed.