views:

142

answers:

2

Is it possible to avoid having the white screen when a page loads? Particularly for the iframes i'm using on my page? it looks odd having a box of white on the screen while the parent contents are themed already.

Thanks in advance!! :)

+2  A: 

Have you tried setting the background color of the iframe to the background color of your parent page?

Jonathan S.
i didn't set any background to the iframe..should i do that? cause it'll probably only affect the way it shows when the frame already loads. my iframe's background now is transparent so the contents of the frame are lying on top of the parent page's themes. you can check out the site: giroapps.comThanks!! :)
laura
A: 

If the iframes are on the same domain, you could use JavaScript to set style.visibility= 'hidden' on the iframes from the parent document, then have the child documents reach up into the parent document and call a function to set visibility back to visible when they're loaded enough to have a stylesheet with the correct background. (onload on the child frame, or potentially sooner.)

I don't know that it's worth it, really. People are used to incomplete rendering whilst a page loads.

bobince
yup..the iframes are on the same domain..how do i do this exactly? :)thanks in advance!!
laura
Well, in the simplest case you could have `<iframe id="fooframe" src="child.html" style="visibility: hidden">` in the parent document, and in the child document say `<script type="text/javascript">window.onload= function() { window.parent.getElementById('fooframe').style.visibility= 'visible'; };</script>`. However it would be better to make the hiddenness happen only when JavaScript was enabled, else the iframe will never appear on browsers where JS is unavailable. And also you might want to enable visibility again sooner than `onload` if the child document has a lot of image content.
bobince