如果使用IE8模拟IE7的头标签不起作用该怎么办?

时间:2009-07-08 11:45:06

标签: .net internet-explorer firefox

根据以下post的建议,我将以下代码添加到我的客户端.NET网站中。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
  <head>
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 

由于某种原因,网站仍未正确显示菜单。如果我进入IE8菜单并添加Web URL以始终以兼容模式显示,则该站点开始正常工作。我该怎么办?

注意:这是一个建于2006 - 2007年的旧网站。这不是当前发展的网站。

4 个答案:

答案 0 :(得分:6)

  

我该怎么办?

找出阻止菜单在IE8中运行并修复它的原因。解决问题的根本原因比治疗症状更好。根本问题是菜单被破坏了。您打算通过让IE显示它就好像它是另一个浏览器来掩盖它。修复根本原因,这种兼容性问题不会引起关注。

编辑:

无论如何,根据this articleIE=EmulateIE7元标记可能会将网页解释为标准或怪癖,具体取决于网页的doctype。由于您的doctype是过渡性的,因此它可能使用您不想要的模式。我要做的是尝试该页面上列出的其他模式:

Quirks*            IE=5          IE 5.5 (Quirks) rendering mode
IE 7 Standards*    IE=7          IE 7 standards rendering mode
IE 7 Emulation     IE=EmulateIE7 IE 7 standards or Quirks rendering, depending on DOCTYPE
IE 8 Standards*    IE=8          IE 8 standards rendering mode
IE 8 Emulation     IE=EmulateIE8 IE 8 standards or Quirks rendering, depending on DOCTYPE
Latest Mode*       IE=edge       Always use the latest standards rendering mode

答案 1 :(得分:0)

您是否尝试过在IIS中添加http网站?

X-UA兼容:IE = EmulateIE7

http://blogs.msdn.com/ie/archive/2008/06/10/introducing-ie-emulateie7.aspx列出了一些关于如何在不同版本的IIS上执行此操作的链接。

然而,就像Welbog上面所说的那样,你应该在IE8中使这个工作。引入该标题是为了更容易将现有网站迁移到IE8,而不是用于开发中的新网站。

答案 2 :(得分:0)

您是否尝试过IE=7

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

答案 3 :(得分:0)

如果Emulation标签不起作用,页面很可能会根据User-Agent字符串发回不同的数据。

当站点在兼容性列表中时,用户代理字符串发送“7.0”,但当站点使用META标记时发送“8.0”(因为在服务器要求IE7模式时已发送请求)。

您可以使用Fiddler(www.fiddler2.com)对此进行问题排查,或尝试使用User-Agent选择器插件(http://www.enhanceie.com/ietoys/uapick.asp