How Web Pages Load?
Faiz Mansuri

Faiz Mansuri @faeizmn

Joined:
Jan 7, 2025

How Web Pages Load?

Publish Date: Jun 27
0 0

I’ve been revisiting some fundamentals around script loading and wanted to share a simple visual that clarifies how script placement and attributes impact page performance:

🟢 HTML Parsing
🔵 Script Download
🔴 Script Execution

─────────────────────────────────────────────────────────────

1️⃣ <​script> in


HTML: 🟢🟢 🔴 🟢🟢🟢
Script: 🔵🔴
Parsing stops while the script downloads and runs.
This can delay rendering and hurt perceived performance.

─────────────────────────────────────────────────────────────

2️⃣ <​script> at end of


HTML: 🟢🟢🟢🟢🟢🟢
Script: ------------🔵🔴
HTML finishes parsing before the script loads and executes.
A safer default for avoiding render-blocking.

─────────────────────────────────────────────────────────────

3️⃣ <​script async>
HTML: 🟢🟢🟢🟢🟢🟢
Script: 🔵---🔴
Downloads in parallel and executes as soon as it’s ready.
Can interrupt parsing unpredictably.

─────────────────────────────────────────────────────────────

4️⃣ <​script defer>
HTML: 🟢🟢🟢🟢🟢🟢
Script: 🔵---------------🔴
Downloads in parallel and executes after parsing is complete.
Predictable and non-blocking.

Even small adjustments here can improve metrics like First Contentful Paint and make your site feel faster.

Comments 0 total

    Add comment