Skip to content

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
SituationUse
Early connection to a third-party originpreconnect (head)
Critical resource discovered late (hero image, font)preload (head)
Script needs the DOM, order mattersdefer (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 tweakinline <script>