Lesson 4: Open the browser's X-ray: the Network panel
Lesson objectives:
- Open the developer tools in a browser.
- Switch to the Network panel.
- Read the request list and identify a single request.
Every browser hides a flight-recorder for every page
You do not need special software to see HTTP requests. Every major browser has a built-in tool called developer tools (or DevTools). Inside it is a Network panel that logs every request the browser sends while the tools are open 12.
Explanation
How to open DevTools
The exact shortcut depends on your browser and operating system:
- Chrome / Edge / Firefox on Windows: press
Ctrl + Shift + IorF12. - Chrome / Edge / Firefox on macOS: press
Cmd + Option + I. - Safari: first enable the Develop menu in Preferences, then press
Cmd + Option + I.
Once DevTools is open, click the Network tab.
The request list
The Network panel shows a table. Each row is one request. The default columns include:
- Name — the file name of the requested resource.
- Status — the HTTP status code.
- Type — the kind of resource, such as
document,stylesheet, orimage. - Initiator — what caused this request: the parser reading the HTML, another script, or a redirect.
- Size — how much data was transferred.
- Time — how long the request took 2.
The top row is usually the main HTML document.
Two of these columns repay a closer look. Initiator is how you answer "why was this even requested?" — it points back at the line of HTML or JavaScript that triggered it 2. Size is a transfer figure, not a file size: when the browser answers from its own cache it reports something like "(disk cache)" instead of a byte count, because nothing crossed the network 3.
Inspecting one request
Click a row to open a detail view. The Headers tab shows the request line, request headers, and response headers. The Response tab shows the body the server sent back 1.
One habit worth forming early: the panel only records while it is open 1. If you open DevTools after the page has loaded, the list is empty, and reloading is the fix. For flows that navigate away — a login that redirects — turn on Preserve log so the earlier requests survive the navigation instead of being cleared 1.
Worked example (follow along)
- Open Chrome, Edge, Firefox, or Safari.
- Press
Cmd + Option + I(macOS) orCtrl + Shift + I(Windows/Linux). - Click the Network tab.
- Type
https://example.comin the address bar and press Enter. - You will see a row with the name
example.comorindex.html. Its Type will probably bedocument. Its Status will be200.
Click that row. The Headers tab will show:
Your turn (faded example)
Look at the Network panel after reloading a page. Find the row whose Type is document. What is the Status value for that row?
Answer: it is usually 200.
Summary + what's next
The Network panel is your window into the HTTP conversation. Each row is a request, and clicking a row reveals the request and response headers. Next, you will read the whole story of a page load.
Footnotes
-
Chrome DevTools: Inspect network activity — https://developer.chrome.com/docs/devtools/network ↩ ↩2 ↩3 ↩4
-
Chrome DevTools: Network panel overview — https://developer.chrome.com/docs/devtools/network/overview ↩ ↩2 ↩3
-
MDN: HTTP caching — https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/Caching ↩
练习
Click the top row in the Network list and open the Headers tab. Copy the first line of the request and the first line of the response.
Level 2 (advanced)我的笔记
记下想法、痛点、没懂的地方。只写进这门课的附录,正课文件不动。