Approach 1: Start loading after other components
This approach aims to render the page sooner by loading CSS stylesheets and images in parallel with the JavaScript rather than after the JavaScript. That way, when the JavaScript has finished loading, the CSS and images will have finished loading too and will be ready to use; or at least it will take less time for them to finish loading after the JavaScript has loaded.
To load the CSS stylesheets and images in parallel with the JavaScript, you would start loading them before you start loading the JavaScript. In the case of CSS stylesheets that is easy simply place their<link>
tags before the<script>
tags:
<link rel="Stylesheet" type="text/css" href="css/style1.css" /> <script type="text/javascript" src="js/script1.js"></script>
Starting the loading of images is slightly trickier because images are normally loaded when the page body is evaluated, not as a part of the page head.
In the test page you just saw with...