• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1726
  • Last Modified:

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

0
Allan_Shiels
Asked:
Allan_Shiels
  • 3
1 Solution
 
OMC2000Commented:
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
0
 
OMC2000Commented:
and even simpler

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

works too
0
 
Allan_ShielsAuthor Commented:
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?

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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now