What exactly is the benefit of the HTML5 async attribute on script elements?

前端 未结 6 1981
伪装坚强ぢ
伪装坚强ぢ 2021-02-07 00:33

I have some confusion around the new async attribute to the script element in HTML5 that I hope someone can give a clear answer to.

Browsers are capable of Parallel Conn

6条回答
  •  迷失自我
    2021-02-07 01:27

    Async scripts are executed as soon as the script is loaded, so it doesn't guarantee the order of execution (a script you included at the end may execute before the first script file )

    Defer scripts guarantees the order of execution in which they appear in the page.

提交回复
热议问题