FrontendDeveloper.in

HTML Track Detail

What is the difference between `defer` and `async` on scripts?

  • defer: downloads in parallel, executes after HTML parsing, keeps script order.
  • async: downloads in parallel, executes as soon as ready, order is not guaranteed.

For most app scripts that depend on order, defer is safer.