PROGRAMMER NEWBIE

How computers and the internet work / The internet and operating systems

How the web delivers a page

Trace a browser request through DNS, servers, and an operating system.

Estimated time: 20 minutes

Learning outcome

By the end of this lesson, you will be able to describe what happens when you type a URL into your browser and press Enter — including DNS, servers, and the round trip your request makes.

The journey of a URL

When you type programmer-newbie.dev into your browser and press Enter, about twenty things happen in under a second. This lesson traces the most important ones.

Think of it like mailing a letter:

  • The URL is the address on the envelope.
  • DNS is the phone book that looks up the address.
  • The server is the person at the destination who sends a reply.
  • The response is the letter you get back.
Diagram
sequenceDiagram
  participant B as Browser
  participant D as DNS
  participant S as Server
  B->>D: What is the IP for programmer-newbie.dev?
  D->>B: The IP is 192.0.2.1
  B->>S: GET / HTTP/1.1<br/>Host: programmer-newbie.dev
  S->>B: 200 OK<br/>&lt;html&gt;...&lt;/html&gt;
  B->>B: Render the page

Step by step

1. You type a URL

URL stands for Uniform Resource Locator. It is the web address you see in the address bar. It has three parts:

  • Protocol (https://) — the language the browser and server use to talk.
  • Domain (programmer-newbie.dev) — the human-readable name.
  • Path (/learn) — the specific page or resource.

2. DNS lookup

The browser does not know where programmer-newbie.dev lives. It needs an IP address — a numeric label like 192.0.2.1. Finding this is called a DNS (Domain Name System) lookup.

Your browser first checks its own cache, then your operating system's cache, then your router, and finally a DNS server operated by your internet provider or a service like Cloudflare or Google. If none of them know, the DNS server goes up the chain to find the authoritative answer.

3. Connecting to the server

Once the browser has the IP address, it opens a connection. This uses a protocol called TCP (Transmission Control Protocol), which ensures every piece of data arrives in the right order. If your connection uses HTTPS (the S stands for Secure), it also negotiates encryption during a step called the TLS handshake.

4. The request

The browser sends an HTTP request. It looks something like this:

GET / HTTP/1.1
Host: programmer-newbie.dev
Accept: text/html

This says: "Please give me the main page for programmer-newbie.dev. I prefer HTML."

5. The response

The server receives the request, looks up the page, and sends back a response:

HTTP/1.1 200 OK
Content-Type: text/html

<!DOCTYPE html>
<html>
...
</html>

The first line includes a status code. 200 means success. 404 means the page was not found. 500 means the server had an error.

6. The browser renders

Your browser receives the HTML, then parses it. It finds references to CSS files (styling), JavaScript files (interactivity), images, and fonts. It downloads each of those and builds the page you see.

Common beginner mistakes

  • Thinking a URL and a search query are the same. Typing "programmer newbie" into Google is a search. Typing programmer-newbie.dev into the address bar is a direct request. Both work, but they are different.
  • Confusing the browser with the internet. The browser is a program on your computer. The internet is the network of servers that your browser talks to. If the browser crashes, the internet is still there.
  • Expecting every page to load instantly. Every resource (HTML, CSS, images, fonts) is a separate request. A slow DNS lookup, a large image, or a slow server all add up.

Practice task

Open your browser's developer tools (F12 or right-click → Inspect). Go to the Network tab. Reload this page. You will see every request the browser made — HTML, CSS, fonts, images. Click on any request to see its headers and response.

Recap

  • A URL is an address with protocol, domain, and path.
  • DNS translates the domain into an IP address.
  • The browser opens a connection and sends an HTTP request.
  • The server responds with HTML and a status code.
  • The browser downloads additional resources and renders the page.

Next step

Now that you understand how the web works, you are ready to write your first program. The next lesson introduces Python.

The internet and operating systems / How the web delivers a page

Trace a browser request through DNS, servers, and an operating system.

Back to path