代码之家  ›  专栏  ›  技术社区  ›  Andrey Bushman

为什么[如果…]条件在我的html中不起作用[[副本]

  •  0
  • Andrey Bushman  · 技术社区  · 7 年前

    我打开这个html文件 谷歌Chrome 70.0.3538.67 :

    <!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>

    我希望两个浏览器都有输出:

    大家好!
    你好,我是9号!

    大家好!

    1 回复  |  直到 7 年前
        1
  •  8
  •   Daniel Beck    7 年前

    条件注释是Internet Explorer专有的,在其他浏览器中不受支持。支持已从IE中删除 version 10