Why do we need to use an onload event in the script tag after using the async attribute?

A Invoke code during page loading
B Invoke code during script loading
C Invoke code during downloading
D Invoke code during reloading

Correct Answer: Invoke code during downloading

When using async you don’t know when the file will be downloaded, so you can attach an onload event handler to the script tag. This will allow you to invoke or instantiate any code that will need to be run when the file is downloaded:

Related Questions

What is the purpose of using the async attribute in the script tag?
(i) Why do we remember May Day? (ii) What significant changes happened due to that event? (iii) How did the event happen? (iv) What can be done in present day as a result of that event ? (v) Mention the moral of that event.
What will happen if the browser encounters a script tag without an src attribute?
What is the solution to the absence of a script tag without an src attribute?
What does the Minify return back to the Script tag?
What is the return type of the script tag?
The script tag must be placed in

Next steps