views:

1323

answers:

6
+2  Q: 

Blank page in 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?

A: 

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.

DOK
Thank you that is very interesting and I will test it. View Source is not even opening Notepad in this case. I think I should use a packet sniffer to check what data is actually being transferred.
Liam
Good idea. It's kinda hard to try to diagnose a problem with a completely blank page isn't it? This gave me fits when IE6 SP2 came out and I had pages with empty, named div's that were self-closing. Let us know what you find out.
DOK
+3  A: 

This is a content-type problem from IE. It doens 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;

Dr. Hfuhruhurr
If I change that to text/html, can I still use XHTML?
Liam
You can definitely use XHTML in IE, though as I noted, there are a few quirks. I've been coding XHTML exclusively for years in .Net.
DOK
yes you can, but it will be sent as html. At least you can validate to make sure you have valid xhtml.<br>See also: http://h3h.net/2005/12/xhtml-harmful-to-feelings/
Dr. Hfuhruhurr
another note: xhtml=html, but with the structure of xml
Dr. Hfuhruhurr
+1  A: 

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>
scunliffe
A: 

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).

Mauricio
+1  A: 

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.

Greg Lane
Yes, any tags about content-type and charsets use only characters from the basic ASCII set, as these have the same byte values in many different encodings. If a title tag appears before the content-type, a browser may fail to read the content-type correctly.
Liam
A: 

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.

Baha14