IE9支持条件注释吗?

发布于 2024-09-05 04:51:49 字数 106 浏览 3 评论 0原文

我想我记得在某处读到过 IE9 支持它们,但现在搜索后我找不到任何迹象表明这是真的。

有谁知道 Microsoft 是否会在 IE9 中支持条件注释的明确声明?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清音悠歌 2024-09-12 04:51:49

Platform Preview 支持它们,启动它(或下载它,然后启动它)并查看此示例 - http:// jsbin.com/axaju3

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

在 IE 9 文档模式下测试。

来自 IE 团队的 EricLaw 在下面的评论中直接证实了 CC 在 IE9 中仍然可用。


IE 博客上的最新帖子 表明,作为获得一致的跨浏览器 HTML5 解析的一部分,条件注释在 IE10 的渲染引擎中将不起作用:

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

从 Platform Preview 2 开始确实如此,作者建议您应该使用功能检测作为替代方案。

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.

楠木可依 2024-09-12 04:51:49

Internet Explorer 9 将是支持条件注释的最后版本。随着 Internet Explorer 10 的发布,微软正在翻开新的一页。根据 MSDN 文章条件注释< /a>:

Windows Internet Explorer 10 Release Preview 标准和怪异模式中已删除对条件注释的支持,以提高互操作性和与 HTML5 的合规性。这意味着条件注释现在被视为常规注释,就像在其他浏览器中一样。此更改可能会影响专门为 Windows Internet Explorer 编写的页面或使用浏览器嗅探来更改其在 Internet Explorer 中的行为的页面。

虽然这不会影响大多数在线网站,但有可能会影响您的网站。如果是这样,请考虑使用 x-ua 兼容的元标记或标头来指示 Internet Explorer 模拟 Internet Explorer 9(支持条件注释的最后版本):

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

请注意,这将阻止您访问最新版本浏览器的功能,例如对 HTML5 和 CSS3 的更广泛支持,以及更多 JavaScript API。

最好的解决办法是戒掉有条件的评论。借助 Internet Explorer 10,Microsoft 浏览器的运行方式将开始与其他流行浏览器大致相同,无需过多关注编写特定于 IE 的代码,并且完全不需要条件注释。

条件注释并不是 IE10 中唯一被废弃的东西。 还有更多

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.

峩卟喜欢 2024-09-12 04:51:49

我相信这是必须的,否则大量的网站会同时崩溃,而为 IE9 做这样的启动并不符合微软的最佳利益。

如果存在某种兼容模式,那么该模式可能支持条件注释,但“纯 IE9”不支持。

PS 只是猜测。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文