0Pricing
Web Performance Optimization & Lighthouse · 课时

页面加载的全过程

了解从输入 URL 到看到完全可交互页面之间实际发生的过程,从而掌握性能提升或损失发生在哪些环节。

页面加载的全过程 是 CoddyKit 上的免费 Web Performance Optimization & Lighthouse 课时。 这是第 4 节课,共 4 节。 你可以在下方免费阅读本课时的完整内容 — 然后在浏览器中使用内置代码编辑器和全天候 AI 导师进行实践。 这是 Web Performance Optimization & Lighthouse 学习路径的一部分,你的进度在网页和 CoddyKit 应用中同步。 Web Performance Optimization & Lighthouse 课程共包含 4 节课。

本课时的部分内容尚未翻译,以英文显示。

From URL to Pixels

A page load runs a fixed sequence: DNS, TCP/TLS handshake, request, response, parse, render, interactivity. Each step adds latency — and shows you where to optimize.

DNS Resolution

First the browser resolves a hostname to an IP via DNS. A cold lookup can cost 20-120ms; caching and dns-prefetch cut it down.

<link rel="dns-prefetch" href="https://cdn.example.com">

Connection Setup

Next come the TCP and TLS handshakes — round trips that hurt on high-latency networks. preconnect warms the connection in advance.

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

Time To First Byte (TTFB)

TTFB measures the wait until the response's first byte arrives. It captures network latency plus server time, and delays everything after it.

Parsing the HTML

As bytes arrive, the browser parses HTML into the DOM tree. It also finds linked CSS and JS, which can pause parsing (render-blocking).

Building the Render Tree

The browser merges the DOM with the CSSOM into a render tree, then runs layout (geometry) and paint (pixels) to put content on screen.

First Contentful Paint

First Contentful Paint (FCP) is the first moment the user sees any text or image — the earliest real signal the page is loading.

JavaScript Execution

Scripts must be parsed, compiled, and run on the main thread. Heavy JavaScript blocks rendering and input, dragging down interactivity.

Reaching Interactivity

The page is truly usable only when the main thread is free for clicks. Time to Interactive and Total Blocking Time capture this final stage.

Inspecting the Timeline

DevTools' Performance panel and the PerformanceNavigationTiming API expose every phase — DNS, connection, TTFB, paint — for precise measurement.

const nav = performance.getEntriesByType('navigation')[0];
console.log('TTFB:', nav.responseStart);
console.log('DOM done:', nav.domContentLoadedEventEnd);

Where to Optimize

Optimize by layer: prefetch and CDN for network, caching to cut TTFB, fewer render-blocking assets, and smaller, deferred JavaScript.

Quick Check

Which metric measures the delay until the first byte of the server response arrives?

Recap

You traced a load from DNS through connection, TTFB, parsing, render tree, FCP, JS, and interactivity. Each phase shows where to reclaim seconds.

常见问题解答

「页面加载的全过程」课时是免费的吗?

是的 — 「页面加载的全过程」的完整文本可在网页上免费阅读。要进行交互式练习(内置代码编辑器和全天候 AI 导师)并解锁 Web Performance Optimization & Lighthouse 课程的其余内容,请升级到 CoddyKit PRO。 Web Performance Optimization & Lighthouse 课程共包含 4 节课。

「页面加载的全过程」这节课中我会学到什么?

了解从输入 URL 到看到完全可交互页面之间实际发生的过程,从而掌握性能提升或损失发生在哪些环节。 你通过在浏览器中直接运行的动手代码来练习 Web Performance Optimization & Lighthouse,全天候 AI 导师会在你学习这节课的过程中回答你的问题。

学习 Web Performance Optimization & Lighthouse 需要有经验吗?

无需任何先前经验。CoddyKit 上的 Web Performance Optimization & Lighthouse 课程适合初学者到高级学习者,你可以从这里开始或从头开始,按照自己的节奏学习。 这是第 4 节课,共 4 节。

「页面加载的全过程」课时需要多长时间?

大多数 CoddyKit 课程大约需要 5–10 分钟。每节课都很精短且互动,所以你能稳步进步,并在网页和应用中从离开的地方继续。

我能在这节 Web Performance Optimization & Lighthouse 课中编写并运行代码吗?

能。每节 Web Performance Optimization & Lighthouse 课都包含内置代码编辑器,你可以在浏览器中直接编写并运行真实代码,并获得即时 AI 反馈 — 无需本地设置。

此课程中的所有课时

  1. 什么是 Web 性能?
  2. 性能为何重要
  3. 关键性能指标
  4. 页面加载的全过程
← 返回 Web Performance Optimization & Lighthouse