html - if 条件语句不适用于 IE 11

标签 html internet-explorer click conditional-statements

<分区>

我使用的是 IE 11 版本。 是否有任何其他解决方案可以执行以下操作:

当我尝试在 html webapge 中使用条件 IE 子句时,没有任何反应。 谁能帮我调试这个问题。

<!--[if IE]>
<a href="next-page.php" class="start-button">CLICK ME</a>
<![endif]-->

最佳答案

Conditional statements do not work in IE 10 or 11

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.

如果您真的只需要在那些浏览器上执行代码,而您可能不应该这样做,您可以使用 JavaScript 来做一些事情 feature detection作为替代品。

关于html - if 条件语句不适用于 IE 11,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27470022/

相关文章:

ios - video.js:自动点击播放按钮(绕过 iOS 自动播放限制)

javascript - 使用 jQuery 检测 div 中的元素

html - Bootstrap : display radio button in center of words

javascript - 如何将 4 个不同的工具提示应用到单个图像上

css - IE 条件注释仅适用于某些页面

javascript - Html5shiv 不工作

html - 关于 Internet Explorer 中 CSS 的问题

javascript - jQuery 点击函数只工作一次(新情况)

jquery - 如何为组分配点击功能

html - 为什么这些文本阴影效果不起作用?