The browser and React · Question 9 of 50
What happens when you type a URL into the browser and press Enter?
The whole stack, in order: DNS, the connection, HTTP, then rendering.
The answer
The browser parses the URL and checks its caches. DNS turns the name into an IP address: the browser and OS caches first, then a resolver that asks the root, the TLD and the domain's own name servers. Then it connects: a TCP handshake, then a TLS handshake that checks the certificate and agrees keys (HTTP/3 does both over QUIC). The HTTP request goes out, often to a CDN or a load balancer first, and the server answers with HTML or a redirect.
Rendering: the HTML is parsed into the DOM and the CSS into the CSSOM; together they make the render tree, then layout works out sizes and positions, then paint and compositing put pixels on the screen. Scripts without defer or async block parsing; images, CSS and JavaScript are fetched along the way.
The picture
URL ─▶ cache? ─▶ DNS ─▶ TCP ─▶ TLS ─▶ HTTP GET ─▶ CDN / LB ─▶ server
│ HTML
screen ◀── composite ◀── paint ◀── layout ◀── DOM + CSSOM ◀──┘How would you make that first load faster?
Show the answer
A CDN close to the users, fewer round trips (HTTP/2 or 3, preconnect), less render-blocking CSS and JavaScript, and good caching headers.