Async script Download is what I'm learning right now. I have a question about asyncattr in a script tag - <script async src="...">.
here is some information, http://www.w3schools.com/tags/att_script_async.asp , and my question is - If available, it indicates that the script will be executed asynchronously as soon as it is available. .
Question: If I have 2 scripts:
<script async src="url1.js"><script>
<script async src="url2.js"><script>
and the second scriptshould be executed AFTER the first (it uses some Objectsor functions) - will it be after loading the page? will the script first run first after loading, and then the second or not?
From the bold line above - as I understand it, the faster it loads script- the faster it will be executed, and in our example we will have errors, and the first scriptone was not loaded and executed but the second one is already trying to get it. (and when can we use asyncscript loading? only when our scripts are not independent of each other?)
ps the lazy loading scriptonly way to get the correct script execution order in this case is to prevent errors?
source
share