【问题标题】:Detect IE 7 Emulate while running in IE 8+ [duplicate]在 IE 8+ 中运行时检测 IE 7 Emulate [重复]
【发布时间】:2014-01-09 08:12:04
【问题描述】:

由于某种原因,该应用程序被设计为在 IE 8+ 中强制使用 IE 7 渲染引擎,使用下面的 META 标签

<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />

我想应用一些 IE 7 特定的样式,如下所示。

 <!--[if lte IE 7]>
    <style type="text/css">
    #myElement
    {
       padding-bottom:49.00% !important;
    }
    </style>
<![endif]-->

Code Reference

I am opening the site in IE 8 它模拟 IE 7 模式,但我的样式没有在这里应用。

我如何在此处检测 IE 7 Emulate 模式? 也欢迎使用 jQuery(1.4.1)。

注意: 该应用程序是很久以前设计的,它处于维护模式。所以无法升级 jQuery 版本

更新:我终于用上了

navigator.appVersion.indexOf("Trident")!=-1 
&& document.documentMode==7

【问题讨论】:

  • "该应用程序旨在强制在 IE 8+ 中使用 IE 7 渲染引擎" ...哦,天哪。那是你的第一个错误。
  • @Spudley,我已经读过Detect IE8 Compatibility Mode。但是我怎样才能以编程方式实现呢?
  • 您确定您的浏览器处于正确的模式吗?如果您在 IE 中更改了兼容模式,则此标头不会神奇地重置它。使用 F12 并检查您所处的模式
  • @SimonHalsey, BrowserMode IE 8 , Document Mode IE 7

标签: javascript jquery asp.net css internet-explorer


【解决方案1】:

您的条件注释不正确:

 <!--[if lt IE 7]>

 should be

 <!--[if IE 7]>

第一个写着:IE的所有版本小于7

【讨论】:

  • 我更新了代码参考链接。请检查一下
猜你喜欢
  • 1970-01-01
  • 2012-06-18
  • 1970-01-01
  • 2013-04-13
  • 1970-01-01
  • 1970-01-01
  • 2013-01-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多