Link to home
Start Free TrialLog in
Avatar of Allan_Shiels
Allan_Shiels

asked on

Hide HTML page until loaded

Hi there,

I'm looking for a little bit of code that delays displaying my html page, until all the page is loaded.

That's it really :-)

Avatar of OMC2000
OMC2000
Flag of Russian Federation image

You can do id with JavaScript

<html>
<body onload="document.getElementById('d1').style.display='block'">
<div id="d1" style="display:none">
your content
</div>
</body>
</html>

or alternatively you could load the content of the page into hidden iframe and then reassign its innerHTML property value to innerHTML property  of main window also on onload event
and even simpler

<html>
<body style="display:none" onload="document.body.style.display='block'">
your content
</body>
</html>

works too
Avatar of Allan_Shiels
Allan_Shiels

ASKER

spot on :-)

what would the be the best way to add in a 'data loading' message that displays as the page is loading, and then disappears to show the loaded page?

ASKER CERTIFIED SOLUTION
Avatar of OMC2000
OMC2000
Flag of Russian Federation image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial