huntingbears
huntingbears

Reputation: 1

IE conditional statment not working no matter what I do

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>

Upvotes: 0

Views: 40

Answers (2)

Selay
Selay

Reputation: 6464

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");
}

Upvotes: 0

David Thomas
David Thomas

Reputation: 253308

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

References:

Upvotes: 1

Related Questions