My site loads images very slowly. Some text appears, then some tables, then some images... and then - body background image.
How can I force that nothing should be displayed till whole the page is ready ?
Slow site speeds can result from network congestion, bandwidth throttling and restrictions, data discrimination and filtering, or content filtering. If you notice slow speeds when visiting your site, you can run a traceroute between your computer and your website to test the connection.
Sending the email to the customer. Once you understand the issues that were causing the website to be slow and you've addressed them, you can respond to your customer with an email explaining your findings and suggestions on further actions.
To speed up DomContentLoaded , you can do a few things: Make script tags async where possible. Moving script tags to the end of the document doesn't help speed up DomContentLoaded , as the browser must still evaluate the Javascript before completing the construction of the DOM.
You could add a class at the body
which has display:none
and remove it once the page is loaded..
<body class="loading">
...
</body>
and
<script>
window.onload = function(){document.body.className = '';};
</script>
Probably the easiest / best way would be to use Javascript to do this. The main way I have seen this implemented is the document ready handler revealing all the hidden stuff.
$(document).ready(function() { $('*').show(); }); // Or something similar.
Of course, people like to see some sort of feedback of "progress" so your site doesn't appear poorly coded or as if the server is junk. So a loader bar or whatever.
As I mentioned above, the best place for these types of questions is Stack Overflow, and perhaps this will be moved over there by a higher-ranked individual. In the mean time, here is a very similar question on Stack Overflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With