if conditional statement not working with IE 11 [duplicate]

拈花ヽ惹草 提交于 2019-12-18 03:10:43

问题


I am using IE 11 version. Is there any other solution to do the following:

Nothing happens when I try to use conditional IE clause in the html webapge. Can anyone help me debug this issue please.

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

回答1:


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.

If you really need to execute code just on those browsers, and you probably shouldn't, you can use JavaScript to do some feature detection as an alterantive.



来源:https://stackoverflow.com/questions/27470022/if-conditional-statement-not-working-with-ie-11

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!