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

前端 未结 6 2051
伪装坚强ぢ
伪装坚强ぢ 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:14

    setting async attribute to true makes sure that the script is loaded along with the rendering of html in parallel.This is essential because if script is placed at end of body and in html we are using something that depends on javascript code,so it won't be loaded and creates issue defer can be used but defer just pauses execution of script and renders html

提交回复
热议问题