FlashcardNot attempted
Script loading cheat sheet
Recall it before you reveal
When do you use preconnect, preload, defer, async, dynamic import and an inline script?
Space to reveal
Show answer & explanation
| Situation | Use |
|---|---|
| Early connection to a third-party origin | preconnect (head) |
| Critical resource discovered late (hero image, font) | preload (head) |
| Script needs the DOM, order matters | defer (head), the default choice |
| Independent script (analytics) | async (head) |
| Code the user may never need (modal, chart, route) | dynamic import() |
| Tiny critical config or one-line DOM tweak | inline <script> |