3

I want to display different content on different browsers. I used Internet Explorer 11 and Google Chrome 39. But, in Internet Explorer and all other browsers "Not Internet Explorer" is displayed. Is something wrong with the code? I saw the following code as an answer to one of the same question , then why it is not working now?

code:

<!DOCTYPE html>
<html>
<body>

<!--[if (IE)]><p>This is Internet Explorer</p><![endif]-->

<!--[if !(IE)]><!--> Not Internet Explorer <!--<![endif]-->

</body>
</html>
Community
  • 1
  • 1
Rajesh Surana
  • 883
  • 1
  • 10
  • 15
  • 5
    `[...]Support for conditional comments has been removed in Internet Explorer 10 standards and quirks modes for improved interoperability and compliance with HTML5.[...]` [MSDN: Conditional comments are no longer supported](http://msdn.microsoft.com/en-us/library/ie/hh801214%28v=vs.85%29.aspx) – t.niese Jan 01 '15 at 23:55
  • ^-- yup. Conditionals are only supported by IE 9 and below. Might I suggest using [modernizr](http://modernizr.com/) instead? It's a javascript library for feature detection, which is preferable to version detection. – Joseph Marikle Jan 02 '15 at 00:08
  • 1
    A Google search for "conditional comments IE11" returns as the first result the link http://msdn.microsoft.com/en-in/library/ie/hh801214%28v=vs.85%29.aspx. PS. I may be mistaken, but I seem to recall that these comments were senstive to newlines in the right places. –  Jan 02 '15 at 03:07

1 Answers1

6

Microsoft dropped conditional comments in Internet Explorer as of version 10.

Rob
  • 14,746
  • 28
  • 47
  • 65
  • 1
    @RBT Well, it would have been a welcome decision, if it weren’t for the fact that they’re still needed. As it is, it just gives developers extra trouble. :-/ – Janus Bahs Jacquet Nov 11 '18 at 13:11