This is normal for embedded scripts in HTML. You can add scripts dynamically using the following code:
<script type="text/javascript"> var head = document.getElementsByTagName("head")[0]; var sTag1 = document.createElement("script"); var sTag2 = document.createElement("script"); sTag1.type = sTag2.type = "text/javascript"; sTag1.src = "http://example.com/ex.js"; sTag2.src = "http://google.com/google-maps.js"; head.appendChild(sTag1); head.appendChild(sTag2); </script>
However, this can lead to unexpected results - they cannot be loaded and parsed in the correct order, which is important if script 2 refers to variables or functions from script 1.
If you want your HTML to load before loading scripts, save them sequentially and place them at the bottom of your HTML file, and not in the head tag. This will load the page before loading and parsing the script. See http://developer.yahoo.net/blog/archives/2007/07/high_performanc_5.html .
source share