13

我完全糊涂了——我有一个网站在通过 Cassini(在 Visual Studio 中)运行时在 IE8 中完美呈现,但在部署到 localhost 并通过同一浏览器(IE8)查看时有几个混乱的元素(样式/外观)。

我在 html 和 CSS 文件上运行了 Beyond Compare 3,它们完全相同。在任何情况下,IIS7 可能会以某种方式向浏览器发送额外/不同的信息?有没有人遇到过这样的事情?

请注意,Chrome 和 Firefox 都可以通过 Cassini 和 IIS7 渲染相同的网页。

(更新) IE8 开发者工具按 F12 认为你处于什么浏览器模式和文档模式?

从 Cassini ( http://localhost:22120 ) 运行时,IE8 停留在 IE8 模式(带有打开 IE7 兼容性视图的选项),一切看起来都很棒。

从 IIS7 (http://{machine name}) 运行时,IE8 会自动进入 IE8 Compat View,IE7 标准和事情看起来很糟糕。

4

5 回答 5

17

我的假设(正如我之前的评论中提到的)是 IE 在不同的渲染模式下工作,具体取决于您使用的是 IIS 还是 Cassini,这会导致布局差异。根据工具 | 中的设置,实际上似乎是 IE 导致了这种情况。兼容性视图设置。有两个复选框:

在兼容性视图中显示 Intranet 站点 - 默认情况下选中此项。在兼容性视图中显示所有网站 - 这不是。

无论哪种方式,您都应该使用标准元标记来强制您希望呈现的模式。

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

希望这可以帮助。

于 2009-10-30T19:52:31.717 回答
5

I think the best solution I have found is not far from Paul's one but it tells the browser to use your Internet Explorer version which solved other problems I have with content="IE=8".

Here it is:

<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
于 2012-02-17T14:14:51.887 回答
1

Actually I had the same issue. IE8 has a compatability settings dialog under tools menu. There is a check box which indicates "Display intranet sites in compatability mode". And not that IE7 compatability mode is not the same as using ie7, there are some differences.

于 2011-03-14T07:02:12.830 回答
1

One side note to this issue: if the same page renders differently on different servers but in the same IE8 browser, check your url - IE8 automatically displays in compatibility mode if the domain is not fully qualified.

于 2011-04-08T15:07:03.050 回答
0

如果页面内容相同,则将服务器发送的标头与页面进行比较。

在稍微讨论了一下之后,我想到了兼容模式。尝试手动强制 IE8 以兼容性模式呈现页面。如果渲染没有改变,那么您就知道问题是因为 IE 在从该 Web 服务器读取该页面时以兼容模式渲染该页面。

如果是后者,请查看http://msdn.microsoft.com/en-us/library/dd567845%28VS.85%29.aspx

于 2009-10-30T17:57:39.950 回答