Reputation: 403
In the following example:
<script src="1.js"></script>
<script src="2.js"></script>
<img src="FDA.PNG" alt="" />
The first tag should block the parsing of the html, but according to the timeline, it's not.
All the files are loading at the same time, why?
Upvotes: 1
Views: 228
Reputation: 1073998
Scripts are executed in the order they appear in the HTML (unless you use the async
or defer
attributes). Browsers are perfectly welcome, however, to download them in any order they like, including in parallel, and including in parallel with other resources such as CSS files and images they find in the HTML. This is a Good Thing(tm), it helps our pages load faster. Scripts downloaded before it's their turn to run are held until it's their turn.
The first tag should block the parsing of the html...
Not the parsing. Just the building of the DOM and execution of the scripts.
Upvotes: 4