Chapter 01 of 09Part 1 · The page

What happens when you type a URL

The six steps between pressing Enter and seeing a page: DNS, connection, request, response, parsing and rendering.

11 minBy Zuzo StudioUpdated

10 min

In this chapter you will

  • follow a request from the address bar to the server and back
  • read a status code and the headers of a real response in DevTools
  • explain why CSS and scripts can hold up the first paint

Before you startNo experience needed. Open this page on a laptop if you can, so you can try things as you read.

Check your understanding

3 questions

Q1A page loads its fonts, analytics and images from three different domains. What does that add before those files can be requested?

Show the answer

A DNS lookup and a new connection for each domain Each hostname has to be resolved to an IP address and connected to separately, and each of those steps is a trip across the network.

Q2Why is it common to add defer to a script tag in the head?

Show the answer

It lets the browser keep parsing the HTML and run the script once parsing is done A plain script stops the parser until it has been fetched and run. With defer it downloads in parallel and runs after the document is parsed.

Q3A script changes the width of a box after the page has loaded. Which rendering steps run again?

Show the answer

Layout, then paint and composite for what it affects Size changes where boxes sit, so layout runs again, and the affected area has to be painted and composited after it.

Key takeaways

  1. DNS turns a domain name into an IP address, and every extra hostname on a page costs another lookup.
  2. HTTPS adds a TLS handshake that encrypts the connection and proves the server is who it says it is.
  3. The server answers an HTTP request with a status code, headers and a body, usually HTML.
  4. The browser parses HTML into the DOM and CSS into the CSSOM, then runs style, layout, paint and composite.
  5. CSS blocks the first paint and plain scripts block parsing, so keep CSS lean and load scripts with defer.
Up next · Chapter 02 · 9 min Semantic HTML: structure that means something Choosing the element that says what content is, so browsers, screen readers and search engines understand the page.

02FAQ

Questions on this chapter

Something else on your mind? Email the studio and a designer, not a salesperson, replies within a day.

What happens when you type a URL into a browser?

The browser looks up the domain in DNS to get an IP address, opens a connection and, for HTTPS, a TLS handshake, then sends an HTTP request. The server returns HTML, which the browser parses, fetches the CSS, scripts and images it references, and renders to the screen.

What is the difference between HTTP and HTTPS?

HTTPS is HTTP sent over an encrypted TLS connection. Nobody between the visitor and the server can read or change the page, and the certificate shows the browser it is talking to the real site.