async attribute
A script attribute that downloads the script in the background and runs it as soon as it arrives, without waiting for parsing to finish or for other scripts.
In more detail
async is good for independent scripts such as analytics, because running order is not guaranteed. It still pauses the parser briefly while the script runs.
Related terms
- defer attribute — A script attribute that downloads the script in the background and runs it, in document order, only after the HTML has finished parsing.
- script element — The HTML element that loads or contains JavaScript for the page.
- asynchronous — Describes work that starts now and finishes later, letting the program do other things instead of waiting for it.
Taught in
- Critical Rendering Path: Preload, Prefetch And Scripts — Frontend Architecture & Web Platform