0

I open this html-file in Google Chrome 70.0.3538.67 and Internet Explorer 11.55.17763.0:

<!doctype html>
<html lang="ru">
<head>
    <meta charset="utf-8"/>
    <!-- saved from url=(0014)about:internet -->
    <title>Sandbox</title>
    <link href="index.css" rel="stylesheet"/>
    <script>
        console.log('Hello all!')
    </script>
    <!--[if gt IE 9]>
    <script>
        console.log('Hello from IE newer then 9!')
    </script>
    <![endif]-->
</head>
<body>
</body>
</html>

I expected the output for both browsers:

Hello all!
Hello from IE newer then 9!

But I get only:

Hello all!

Why does it happen?

VLAZ
  • 26,331
  • 9
  • 49
  • 67
Andrey Bushman
  • 11,712
  • 17
  • 87
  • 182
  • As the syntax highlighting clearly shows, the comment doesn't end before the ` – Bergi Oct 18 '18 at 18:01

1 Answers1

8

Conditional comments were proprietary to Internet Explorer, and never supported in other browsers. Support was removed from IE in version 10.

This technique is obsolete and should no longer be depended on (unless you are explicitly targeting IE versions 5 through 9).

Daniel Beck
  • 20,653
  • 5
  • 38
  • 53