确定 IE8 的文档模式图是错误的,或者我遗漏了什么?

发布于 2024-11-17 03:25:44 字数 4273 浏览 2 评论 0原文

我对 IE8 如何确定文档模式有点迷惑。我有矛盾。

设置

这是生成的网页标题在我的网站上的样子,请注意文档类型:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head">
    <meta id="IE8" http-equiv="X-UA-Compatible" content="IE=8" />
    ...

我正在使用设置为 X-UA-Compatiblemeta http-equiv强制它以“标准模式”呈现,因为这个网站就是这样做的。该网站位于公司 LAN (10.1.xx) 中的另一台计算机上。

到目前为止一切都很好,但我在兼容性设置窗口中遇到了困难:

结果:

当兼容性设置中未检查并列出任何内容时,用户代理为:

Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.1;WOW64;Trident/4.0;SLCC2;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30729;.NET4.0C; .NET4.0E) [好的]

仅当选中“在兼容性视图中显示所有网站”:

Mozilla/4.0(兼容;MSIE 7.0;Windows NT 6.1;WOW64;Trident/4.0;SLCC2;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30729;.NET4.0C; .NET4.0E) [一致但不预计]

仅选中“在兼容性视图中显示 Intranet 站点”时:

Mozilla/4.0(兼容;MSIE 8.0;Windows NT 6.1;WOW64;Trident/4.0;SLCC2;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30729;.NET4.0C; .NET4.0E) [不好的]

当该 URL 将添加到“您已添加到兼容性视图的网站”列表中:

Mozilla/4.0(兼容;MSIE 7.0;Windows NT 6.1;WOW64;Trident/4.0;SLCC2;.NET CLR 2.0.50727;.NET CLR 3.5.30729;.NET CLR 3.0.30729;.NET4.0C; .NET4.0E) [一致但不预计]

根据以下IE博客入口图,如果元标签X-UA-Compatible为存在且值为IE=8,则渲染器已设置到“标准模式”。 正如刚才所描述的,事实并非如此。 Meta 始终为 IE=8,但用户代理发生了变化。 该图负责 X-UA-Compatible 元检查后的兼容性视图设置。就我而言,情况似乎恰恰相反。 是不是图错了?

问题:

  • 为什么选中“在兼容性视图中显示 Intranet 站点”时,用户代理是 msie 8.0?! (是因为我的meta吗?http://10.1.xx/真的被视为内网网站吗?) < /p>

  • < p>为什么选中“在兼容性视图中显示所有网站”时,用户代理是msie 7.0??? (这覆盖了我的元数据?但不是根据图表)

  • 为什么当站点添加到兼容性列表时,用户代理是 msie 7.0?

根据该图,我的文档类型属于“几乎标准模式”类别。 似乎有一个更好的元来强制 IE8 标准模式,但根据文档类型:

<meta id="IE8" http-equiv="X-UA-Compatible" content="**IE=EmulateIE8**" />

使用它更好,还是我当前使用的元(强制 IE=8)更好? 看起来几乎标准模式正是标准模式,只是对表格中图像的渲染进行了细微的更改,好吧,但是......我应该选择哪一个?

然后该图再次提到“IE=Emulate8”,但 这篇文章讲的是“IE=EmulateIE8”,看来后者是正确的版本根据http-equiv的文档

有没有办法检测(客户端/网络)IE 是否处于“几乎标准模式”或“标准模式”?

一些值得一提的链接:

http:// /blogs.msdn.com/b/ie/archive/2008/08/27/introducing-compatibility-view.aspx

http:// /blogs.msdn.com/b/ie/archive/2009/02/16/just-the-facts-recap-of-compatibility-view.aspx

http://msdn.microsoft.com/en-us/library/ ms533876(VS.85).aspx

http://msdn.microsoft.com/fr-fr/library/cc288325(VS.85).aspx

http://blog.strictly-software.com/2009/03/detecting-ie-8-compatibility-modes-with.html

http://phrogz.net/ie8-intranet-compatibility-view

http://hsivonen.iki.fi/doctype/ -> http://hsivonen.iki.fi/doctype/ie8-mode.png

javascript:alert(navigator.userAgent)
javascript:alert(document.compatMode);
javascript:alert(document.documentMode);

I'm kind of lost with how IE8 determines the document mode. I got contradictions.

Setup

This is what a generated web page header looks like on my website, please note the doctype:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head">
    <meta id="IE8" http-equiv="X-UA-Compatible" content="IE=8" />
    ...

I'm using the meta http-equiv setted to X-UA-Compatible to force it to render in "standard mode", because this website has been made so. The website is on another machine in the company LAN (10.1.x.x).

Everything is ok up to now, but I'm having difficulties with the compatibility settings window:

Results:

When nothing is checked and listed in compatibility settings, user agent is:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E) [ok]

When only "Display all websites in Compatibility View" is checked:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E) [coherent but not expected]

When only "Display intranet sites in Compatibility View" is checked:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E) [not ok]

When the URL is added to the list of "Websites you've added to Compatibility View":

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E) [coherent but not expected]

According to the following IE blog entry diagram, if the meta tag X-UA-Compatible is present and value is IE=8, the renderer is setted to "Standards mode".
As just described, that is not the case. Meta was always IE=8 but the user agent changed.
The diagram takes care of the compatibility view settings after the X-UA-Compatible meta check. In my case, it looks like the opposite.
Is the diagram wrong?

Questions:

  • Why the user agent is msie 8.0 when "Display intranet sites in Compatibility View" is checked?! (is it because of my meta? Is http://10.1.x.x/ really considered as an intranet website?)

  • Why the user agent is msie 7.0 when "Display all websites in Compatibility View" is checked??? (this override my meta ? but not according to diagram)

  • Why the user agent is msie 7.0 when the site is added to the compatibility list ?

According to the diagram, my doctype falls in the "Almost Standards Mode" category.
Seems there's a better meta to force IE8 standard mode, but according to the doctype:

<meta id="IE8" http-equiv="X-UA-Compatible" content="**IE=EmulateIE8**" />

Is it better to use it, or the one I'm currently using (force IE=8)?
Seems Almost Standards Mode is exactly the Standard Mode with a subtle change for the rendering of images in a table, ok but... which one should I pick?

Then again the diagram mention "IE=Emulate8" but this article talks about "IE=EmulateIE8", seems like the later is the correct version according to the documentation of http-equiv.

Is there a way to detect (client side/network) if IE is in "Almost Standards Mode" or "Standards Mode" ?

A few links worth mentioning:

http://blogs.msdn.com/b/ie/archive/2008/08/27/introducing-compatibility-view.aspx

http://blogs.msdn.com/b/ie/archive/2009/02/16/just-the-facts-recap-of-compatibility-view.aspx

http://msdn.microsoft.com/en-us/library/ms533876(VS.85).aspx

http://msdn.microsoft.com/fr-fr/library/cc288325(VS.85).aspx

http://blog.strictly-software.com/2009/03/detecting-ie-8-compatibility-modes-with.html

http://phrogz.net/ie8-intranet-compatibility-view

http://hsivonen.iki.fi/doctype/ -> http://hsivonen.iki.fi/doctype/ie8-mode.png

javascript:alert(navigator.userAgent)
javascript:alert(document.compatMode);
javascript:alert(document.documentMode);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别挽留 2024-11-24 03:25:44

IE Dev 工具指示正在使用哪个渲染引擎。

IE Dev工具

不要依赖用户代理字符串来确定渲染引擎。

IE Dev tools indicate which rendering engine is being used.

IE Dev tools

Don't rely on the User Agent string to determine the rendering engine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文