Detecting any and all versions of Internet Explorer
conditional-comments, html, internet-explorer, internet-explorer-10, javascript
Solution
I appreciate all your insight, but none of it answers my actual question. Again, I am not asking about the feature detection. All I need to know is if the web browser is IE or not. The following uses JavaScript and seems to work for all current versions of IE (including IE10):
<![if IE]>
<script type='text/javascript'>
if(/*@cc_on!@*/false)
var bIsIE = 1;
</script>
<![endif]>
and then to check if it's IE, do this from JavaScript:
if (typeof (bIsIE) != 'undefined')
{
//The web browser is IE
}
else
{
//The web browser is not IE
}
Obviously the code above assumes that the web browser has JavaScript enabled. But in my case the browser detection is relevant only if it has scripts enabled.
Problem
There used to be a nice way to tell if a web browser is IE or not, by using this technique in HTML: ``` <!--[if IE]> Non-IE browsers ignore this <![endif]--> ``` or ``` <!--[if !IE]--> IE ignores this <!--[endif]--> ``` but this doesn't work anymore in IE 10. Any idea what to use instead to tell IE from other web browsers (using HTML or JavaScript)? PS. I need to be able to tell ANY version of IE from non-IE web browser.