detect IE11 without JavaScript in HTML/CSS
26,559
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
Author by
user984003
Updated on July 09, 2022Comments
-
user984003 almost 2 years
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.