How to control or prevent rendering of HTML page till it download all resource file?
-
12-06-2021 - |
Pergunta
How to control rendering of HTML page till it download its all HTML, CSS and JS dependencies?
Adding to the above question, how to validate that all the dependencies have been downloaded successfully ?
FRAMEWORK I AM USING:- jQuery, Twitter Bootstarp
Browser compatibility required:- IE8+, Chrome, Firefox, Safari
Solução
This might work. Basically, you hide the body by default. When everything loads, you show it:
HTML:
<body class="placeholder">
...
</body>
CSS:
.placeholder {
display: none;
}
JavaScript:
$(document).load(function() {
$('body').removeClass('placeholder');
});
Just as a question: why would you need to do this?
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow