Compartir a través de


Conditional comments are no longer supported

Support for conditional comments has been removed in Internet Explorer 10 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.

Note  Most pages are unaffected by this change.

 

A page using Conditional Comments worked as intended in Windows Internet Explorer 9, but no longer works in Internet Explorer 10.

If the page works correctly in other browsers, consider using feature detection to treat Internet Explorer 10 like other browsers. Otherwise, add the following meta tag near the top of the page to opt into Internet Explorer 9 behavior:

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

The following example page uses Conditional Comments and might be impacted by this change:

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

The page can be fixed quickly by opting into Internet Explorer 9 behavior, as shown here:

<html>
  <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9">
  <!--[if IE]>
    This content is ignored in Internet Explorer 10 and other browsers.
    In older versions of Internet Explorer, it renders as part of the page.
  <![endif]-->
</html>

The long-term solution is to remove the dependency from the code.

Conditional Comments

IEBlog Post: HTML5 Parsing in IE10

How to Detect Features Instead of Browsers