Trivia Questions2 min readPremium

Can you explain the process from the time you type in a website’s URL to it finishing loading on your screen? What happens?

 

From URL to Screen: The Journey of a Web Request

Ever wondered what happens behind the scenes from the moment you enter a website’s URL to when its content is fully displayed on your screen? Let’s break down the intricate process that unfolds in mere milliseconds. In short, this is what happens when you type a URL and press Enter, and MDN’s guide on how browsers work covers the same journey.

1. DNS Resolution

The journey begins with translating the human-friendly domain name into a computer-friendly IP address through DNS resolution. This involves querying DNS servers until the correct IP address is found.

2. TCP Connection Establishment

Next, your browser initiates a TCP connection with the server. This three-way handshake process ensures a reliable connection is established between your browser and the server hosting the website. For HTTPS, a TLS handshake follows to negotiate encryption and verify the server’s certificate. (HTTP/3 uses QUIC over UDP, which combines these steps.)

3. HTTP Request Dispatch

With a stable connection, the browser sends an HTTP request to the server, asking for the desired web content. This request includes headers and sometimes cookies, carrying additional information about the browser and user session.

4. Server-side Processing

The server processes the incoming request. This may involve database queries, server-side calculations, or dynamic content generation based on the request’s specifics.

5. HTTP Response and Content Delivery

The server responds with an HTTP response, including status codes, headers, and the requested content, usually HTML for web pages.

6. Browser’s Interpretation and Rendering

The browser interprets the received HTML, CSS, and JavaScript, constructing the DOM and CSSOM trees, and begins the rendering process, transforming code into visual content.

7. Final Rendering and Interaction

The browser lays out the page, paints the elements, and executes any JavaScript, making the page interactive. As users interact with the page, event listeners handle clicks, scrolls, and other inputs.

This complex sequence of steps, involving multiple technologies and protocols, showcases the efficiency and speed of modern web browsers and the internet infrastructure, delivering content from anywhere in the world to your screen in an instant.