Calling document.write after page load causes blank screen

I came across some interesting behavior when calling document.write multiple times. The first time I called it was fine, but if I called it again in a setTimeout, the page would go blank. Turns out that it’s because once the page loads and fires document ready event, it doesn’t know where the current cursor is. This causes the browser (happens in at least IE and FireFox) to start the page over from scratch, thus showing a blank screen.

So, don’t make the javascript call document.write after the page has loaded!

See this for more information

Hope that helps you!


Posted

in

,

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *