3
I was reading about the attribute async, which is used in the tag <script>, and I got curious and doubtful about some things.
According to the W3school:
A script that will be run asynchronously as soon as it is available
Translating:
A script that will run asynchronously, so it is available
I have a few questions regarding this implementation:
With the implementation of the
async, I must now stop put some scripts in<body>from my page (as in the case of jQuery UI, which is heavy), or are things different ?Using it may imply some performance problem or variable definitions in a certain context (e.g., if I use in the
jQuery, occur some "excessive waiting" to define the variable$as a reference tojQuery)?The
assyncdoes the same (or at least does the same) as definition of acallbackinwindow.onload?What are the main advantages of using it ?
Briefly, the script is downloaded without blocking the page rendering. It then runs, even if the page has not been fully loaded. Maybe that question help on some points.
– Renan Gomes
I marked as duplicate because I believe that the answer to the other question clarifies all these doubts.
– bfavaretto
All right @bfavaretto
– Wallace Maxters