【问题标题】:How to conditionally apply x-ua meta tag only to ie10 and below?如何有条件地将 x-ua 元标记仅应用于 ie10 及以下?
【发布时间】:2019-03-27 07:12:25
【问题描述】:

我有一种情况,在header中添加了如下x-ua代码

<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7" />

它在 IE 10 及以下版本中运行良好。 但它使某些功能在 IE11 中不起作用

如果删除了元标记,功能将在 IE11 中正常工作,但现在 我无法完全删除元标记,因为我的应用程序必须支持 IE9+ 版本,并且删除将使功能无法在 IE10 中运行

【问题讨论】:

    标签: html internet-explorer meta-tags ie8-compatibility-mode x-ua-compatible


    【解决方案1】:

    试试这个:

    <!--[if IE 9]>
        <meta http-equiv="X-UA-Compatible" content="IE=8" />
    <![endif]-->
    <!--[if gt IE 9]>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <![endif]-->
    

    注意:IE10 不支持条件 cmets https://docs.microsoft.com/en-us/previous-versions/windows/internet-explorer/ie-developer/compatibility/hh801214(v=vs.85)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-11-01
      • 1970-01-01
      • 2012-06-27
      • 1970-01-01
      • 2015-08-19
      • 2012-06-01
      • 2016-02-05
      • 2017-07-09
      相关资源
      最近更新 更多