23

I thought I remembered reading somewhere that IE9 would not be supporting them, but now after searching I can't find any indication that this is true.

Is anyone aware of a definitive statement, either way, about whether Microsoft will be supporting conditional comments in IE9?

3
  • 12
    Let´s hope IE9 simply doesn't need conditional comments.
    – jeroen
    Jun 8, 2010 at 23:22
  • 4
    @jeroen: Ha ha ha ha haaaaaaaaa. Oh, wow. Apr 13, 2011 at 0:03
  • 1
    I recommend going forward that you do not code using conditional comments. It will be dropped for IE 10; although it will work for older browsers.
    – Phil
    May 21, 2012 at 14:41

3 Answers 3

21

The Platform Preview supports them, fire it up (or download it, then fire it up) and see this example - http://jsbin.com/axaju3:

<!--[if IE 9]>
    <p>You are using IE 9</p>
<![endif]-->

Tested in IE 9 Document Mode.

Straight from the horse's mouth, EricLaw from the IE team has confirmed in the comments below that CCs are still available in IE9.


A recent post on the IE blog shows that, as part of the effort to get consistent cross-browser HTML5 parsing, conditional comments will not work in IE10's rendering engine:

<!--[if IE]>
This content is ignored in IE10 and other browsers.
In older versions of IE it renders as part of the page.
<![endif]-->

This is true as of Platform Preview 2 and the author suggests you should use feature detection as an alternative.

0
6

Internet Explorer 9 will be the last version to support conditional comments. With the release of Internet Explorer 10, Microsoft is turning over a new leaf. According to the MSDN article on Conditional Comments:

Support for conditional comments has been removed in Windows Internet Explorer 10 Release Preview standards and quirks modes for improved interoperability and compliance with HTML5. This means that Conditional Comments are now treated as regular comments, just like in other browsers. This change can impact pages written exclusively for Windows Internet Explorer or pages that use browser sniffing to alter their behavior in Internet Explorer.

While this will not affect the majority of sites online, there's a chance it may affect yours. If it does, please consider making use of the x-ua-compatible meta tag or header to instruct Internet Explorer to Emulate Internet Explorer 9 (the last version to support conditional comments):

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">

Note that this will prevent you from having access to the newest features of the browser, like broader support for HTML5, and CSS3, as well as more JavaScript APIs.

The best solution is to ween yourself off of conditional comments. With Internet Explorer 10, Microsoft's browser will begin to operate much the same way other popular browsers do, requiring less attention to writing IE-specific code, as well as removing the need for conditional comments altogether.

Conditional Comments aren't the only thing to become obsolete in IE10. There's more.

1
  • 1
    best answer, imo. The meta tag really helped debugging a lot of IE vers. issues. many thanks!
    – RCNeil
    Jan 24, 2013 at 19:57
3

I believe it will have to, otherwise a huge amount of sites will break all at once and it's not in the best Microsoft's interests to make that sort of start for IE9.

If there is going to be some sort of compatibility mode, then it is possible conditional comments will be supported in this mode but not in "pure IE9".

P.S. Just speculations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.