While I was testing my web apps in the new Internet Explorer 7 I discovered that sometimes a page is not rendered properly after a refresh. After some testing I realized that somehow the browser is randomly showing a blank (white) page when I hit the reload button a couple of times. The interesting thing was that when I viewed the sourcecode everything was there but the page wasn’t displayed at all. I did some research and found the reasons/solutions for it.
Problem: IE7 displays a blank page after doing some refresh’s.
Environment: classic ASP application, WIN XP Pro, IIS 5.1
Reproduction: create the following page and refresh it a couple times:
- <% response.buffer = true %>
- <script src="somescript.js"/>
- test, test
- <% response.flush() %>
Solution: There are two points I’ve found out…
- check if you have any scripts (script src=”..”/> loaded within the -tag. If yes then you’ll have to move them to the body and everything should work. As far as I remember the W3C says “This element may appear any number of times in the HEAD or BODY of an HTML document.” [W3C Script element] Anyway
- if you are using classic ASP you also need to assure that you don’t flush the response at the end of your page. Remove the response.flush() line and your apps should work fine.
Okay now lets move on to the details. I was searching the web and there are hardly any resources for this bug yet. I found a post about it in the MSDN forums (IE 7 display blank page on refresh when viewing session enabled PHP pages served from IIS 6!!) where a guy experienced the same in his PHP apps and I’ve found a post by a guy called Kerry D. Wong who blogged about a similar issue (Meta Refresh Bug in IE7?) but in my case it did not solved the problem but i came closer.
Ahm, where should I send the invoice?
As there aren’t almost any resources about this bug on the web yet I cannot really tell you the detailed reasons for it but I am sure they will pop up soon. I guess it has something to do with the keep-alive requests. There is a remark about the response.flush() method in the MSDN documentation which says: “If the Flush method is called on an ASP page, the server does not honor Keep-Alive requests for that page.”.