Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect IE11 without JavaScript in HTML/CSS [duplicate]

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.

like image 451
user984003 Avatar asked Jan 18 '14 12:01

user984003


1 Answers

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

like image 194
Kevin Woblick Avatar answered Nov 19 '22 12:11

Kevin Woblick