开发者

Flash of white screen before page & iframe loads

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!! :)


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


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.


You could make the iframe invisible until it loads.

Making it invisible with the following iframe.style.visibility='hidden'; will make your iframe hidden but it will still occupy the space it used to have

And when it loads simply make it visible again with iframe.style.visibility='visible'; and you won't see any flashing..

Clean and simple imo.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜