By default, javascript is loaded synchronously, that is, javascript is blocked when loading. The subsequent elements must wait for javascript to be loaded before they can be loaded again. For some javascript that is not very meaningful, if it is placed at the head of the page, it will cause the loading to be very slow. If so, it will seriously affect the user experience.
(1) defer, only supports IE
Definition and usage of defer attribute (I took it from w3school website)
defer attribute specifies whether to delay script execution until the page until loaded.
Some javascript scripts use the document.write method to create the current document content, but other scripts may not.
If your script does not change the content of the document, you can add the defer attribute to the <script> tag to speed up processing of the document. Because the browser knows that it will be able to safely read the remainder of the document without executing the script, it will defer interpretation of the script until the document has been displayed to the user. <br>Example: <br></p>
<div class="codetitle">
<span><a style="CURSOR: pointer" data="71033" class="copybut" id="copybut71033" onclick="doCopy('code71033')"><u>Copy code</u></a></span> The code is as follows:</div>
<div class="codebody" id="code71033"> <br><script type="text /javascript" defer="defer"> <br>alert(document.getElementById("p1").firstChild.nodeValue); <br></script>