IE6中的空白页

发布于 2024-07-08 15:27:51 字数 570 浏览 7 评论 0原文

我正在开发的一个使用 PHP 构建的网站有时会显示完全空白的页面。 客户端或服务器上没有错误消息。 同一页面有时可能会显示,但其他页面则不会。 所有页面在 IE7、Firefox 3、Safari 和 Opera 中均工作正常。 所有页面都是带有此元元素的 XHTML:

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

似乎我已通过添加此 PHP 代码解决了该问题:

header('Content-type: text/html; charset=utf-8');

我已了解到该问题可能是由 XHTML、编码、gzip 压缩或缓存引起的,但没有人能够支持这些猜测。

由于问题是间歇性的,我不确定我的解决方案是否真正解决了问题。

我的问题是,当其他浏览器显示内容时,是否有可重现的方法让 IE6 显示空白页面? 如果是这样,是什么原因导致的以及如何解决?

A site I am working on that is built using PHP is sometimes showing a completely blank page.
There are no error messages on the client or on the server.
The same page may display sometimes but not others.
All pages are working fine in IE7, Firefox 3, Safari and Opera.
All pages are XHTML with this meta element:

<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

It appears that I have fixed the problem by adding this PHP code:

header('Content-type: text/html; charset=utf-8');

I have read that this problem may be caused by XHTML, encoding, gzip compression, or caching, but nobody has been able to backup these guesses.

As the problem was intermittent I am not confident that my solution has actually solved the problem.

My question is, are there reproducible ways of having IE6 show a blank page when other browsers display content?
If so, what causes it and what solves it?

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

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

发布评论

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

评论(6

呆萌少年 2024-07-15 15:27:51

这是 IE 的内容类型问题。
它不知道如何处理application/xhtml+xml。

虽然你写的是xhtml+xml,但是IE只认识text+html。
在所有代理都知道 xhtml+xml 之前,这将是未来

将内容类型的元标记更改为 content="text/html;

This is a content-type problem from IE.
It does not know how to handle application/xhtml+xml.

Although you write xhtml+xml, IE only knows text+html.
It will be the future before all agents know xhtml+xml

change your meta tag with content type to content="text/html;

为你拒绝所有暧昧 2024-07-15 15:27:51

听起来像 bug #153“自动关闭IE 中的“脚本标记” 错误,众所周知会导致空白页面

由于 IE 的错误,您永远不能编写以下代码并期望它在 IE 中运行。

<script src="...." />

(如果标签是自动关闭的,那么您将陷入痛苦的世界)

相反,请始终编码为;

<script src="...."></script>

Sounds like bug #153 "Self Closing Script Tag" bug in IE, which is well known to cause blank pages.

Due to IE's bug, you can NEVER code the following and expect it to work in IE.

<script src="...." />

(if the tag is self closing, you are in for a world of pain)

Instead, always code as;

<script src="...."></script>
天邊彩虹 2024-07-15 15:27:51

我有一个类似的特定于语言的问题 - 只有带有多字节字符的页面在 IE6 和 IE7 中没有显示。 事实证明,在这两个浏览器中,Content-Type 元标记和标题标记的顺序很重要。 因此,将标签(包含日语字符)放在元标签之后解决了问题。

I had a similar problem that was language specific - only the page with multibyte characters didn't show in IE6 and IE7. Turns out in these two browsers, the order of the Content-Type meta tag and the title tag is a big deal. So putting the tag (which contained Japanese characters) after the meta tag fixed the problem.

太阳哥哥 2024-07-15 15:27:51

不确定这是否完全符合您的经验。 这取决于所使用的 IE 的特定版本(包括服务包)。

IE6 SP2 和 IE6 SP2 的已知渲染问题 IE7(都使用相同的渲染引擎)是 HTML 中存在孤立标签的原因。 这可能是孤立的 div 或 script 标签。

<script language="javascript">    // no closing tag
alert('hello world');
<body>
hello world
</body>

上面的内容在 IE6 SP1 和 Firefox 中渲染得很好,但在 IE6 SP2 和 Firefox 中你只会看到一个空白页面。 IE7。

还有某些其他标签必须有单独的结束标签。 检查所有

标签,而不仅仅是开始标签末尾的结束斜杠。 另一种是

如果您可以查看空白页面的源代码并获取源 html,即使您的页面是空白的,您也可以测试您的网站是否出现这种情况。

Not sure if this exactly matches your experience. It depends on which specific version of IE (including service packs) is being used.

A known rendering issue with IE6 SP2 & IE7 (both use the same rendering engine) is the existence of orphaned tags in your HTML. This may be an orphaned div or script tag.

<script language="javascript">    // no closing tag
alert('hello world');
<body>
hello world
</body>

The above renders just fine in IE6 SP1 and Firefox, but you will only see a blank page in IE6 SP2 & IE7.

There are certain other tags that must have a separate closing tag. Check that any <div> and <script> tags have an ending </script> or <div> tag, not just a closing slash at the end of the opening tag. Another one is <textarea>. You have to have both tags.

You can test if this is occurring with your site if you can View Source of your blank page and get the source html even though your page is blank.

十年九夏 2024-07-15 15:27:51

您应该向 IE 用户提供 Content-Type 标头为 text/html 的页面。 您不需要更改元标记,只需将其保留为 application/xhtml+xml (IE 将忽略它)。

You should serve pages with the Content-Type header as text/html to IE users. You don't need to change the meta tag, just leave it as application/xhtml+xml (IE will ignore it).

夏尔 2024-07-15 15:27:51

由于打字错误,我遇到了这个错误。

我写了元标记:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />

谢谢你,我将其更正为:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

现在我没有问题了。

I got this bug due to a typing error.

I wrote the meta tag :

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />

Thanks to you i corrected it to :

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

and i haven't the problem now.

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