0

This is incredibly frustrating, the if IE statement does not seem to work no matter what I do

I'm using IE 10

Here's the code:

<!DOCTYPE html>
<html>
<head>
<title></title>

</head>
<body>
<!--[if IE]> 
<h1>You are using Internet Explorer</h1> 
<![endif]--> 

</body>
</html>
huntingbears
  • 1
  • 1
  • 3
  • A possible duplicate of [How do I target only Internet Explorer 10 for certain situations like Internet Explorer-specific CSS or Internet Explorer-specific JavaScript code?](http://stackoverflow.com/questions/9900311/how-do-i-target-only-internet-explorer-10-for-certain-situations-like-internet-e) – David Thomas Aug 08 '13 at 16:29

2 Answers2

1

The problem you're having is that conditional comments do not work, and are deprecated, in Internet Explorer 10.

References:

David Thomas
  • 249,100
  • 51
  • 377
  • 410
0

If somebody still reaches this page, wondering why the ie targeting doesnt work. IE 10 and onward no longer support conditional comments. From the MS official website:

Support for conditional comments has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5.

Please see here for more details: http://msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx

If you desperately need to target ie, you can use this jquery code to add a ie class to and then use .ie class in your css to target ie browsers.

if ($.browser.msie) {
 $("html").addClass("ie");
}
Selay
  • 6,024
  • 2
  • 27
  • 23