detect IE11 without JavaScript in HTML/CSS [duplicate]

帅比萌擦擦* 提交于 2019-12-23 09:32:19

问题


I have been using the following trick to make browser-specific HTML:

<!--[if (IE)]>  <div class= "ie"> <![endif]-->
<!--[if !(IE)]><!--> <div class= "not_ie"> <!--<![endif]-->
</div>

This does not work with IE11. Any new tricks to use?

I can detect it using JavaScript:

Detecting IE11 using CSS Capability/Feature Detection

or

Object.hasOwnProperty.call(window, "ActiveXObject") && !window.ActiveXObject)

but I'm hoping to avoid that.


回答1:


IE 11 does not longer support conditional comments in your HTML code. So you have to use Javascript.

Microsoft Dev Center - IE 10+ Conditional Comments



来源:https://stackoverflow.com/questions/21204017/detect-ie11-without-javascript-in-html-css

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