π What Happens When You Type a URL?
Every time you visit a website, an incredible chain of events unfolds in milliseconds. Before writing a single line of HTML or CSS, it helps to understand what's actually happening behind the scenes.
In this module, you'll learn about the key players β browsers, servers, DNS, and HTTP β and see how they work together to deliver web pages to your screen.
The Journey of a Web Request
π― By the end of this module, you will:
- Explain the roles of browsers and servers
- Break down the parts of a URL
- Understand how DNS translates domain names to IP addresses
- Describe the HTTP request/response cycle
- Read and interpret common HTTP status codes
- Use Chrome DevTools to inspect network traffic
π Anatomy of a URL
A URL (Uniform Resource Locator) is the address of a resource on the web. Let's break one down:
https://www.example.com:443/products/shoes?color=red&size=42#reviewshttps://
www.example.com
:443
/products/shoes
?color=red&size=42
#reviews
| Part | Example | Purpose |
|---|---|---|
| Protocol | https:// |
The "language" for communication. HTTPS = encrypted. |
| Domain | www.example.com |
Human-readable name for the server. |
| Port | :443 |
Door number on the server. 80 = HTTP, 443 = HTTPS. |
| Path | /products/shoes |
Location of the resource on the server. |
| Query | ?color=red |
Extra parameters (filters, search terms, etc.). |
| Fragment | #reviews |
Jumps to a specific section on the page. |
π₯οΈ Client & Server Model
The web is built on a simple idea: a client (your browser) asks for something, and a server (a computer somewhere) sends it back.
ClientβServer Communication
Sends requests, renders HTML/CSS
Processes requests, sends responses
π What the Browser Does
- Sends HTTP requests to servers
- Receives HTML, CSS, JS, images
- Parses HTML into a DOM tree
- Applies CSS styles
- Executes JavaScript
- Renders the final visual page
π₯οΈ What the Server Does
- Listens for incoming requests
- Finds the requested resource
- Runs server-side code (if needed)
- Queries databases
- Sends back the response (HTML, JSONβ¦)
- Includes a status code (200, 404β¦)
π DNS: The Web's Phone Book
Computers communicate using IP addresses (like 93.184.216.34). But humans prefer names like example.com. DNS (Domain Name System) is the translator between the two.
DNS Resolution Steps
π‘ HTTP: The Language of the Web
HTTP (HyperText Transfer Protocol) is the set of rules browsers and servers use to communicate. Every web page you visit involves at least one HTTP request and response.
π€ HTTP Request (what the browser sends)
π₯ HTTP Response (what the server sends back)
Common HTTP Methods
GET
Retrieve data (load a page)
POST
Send data (submit a form)
PUT
Update existing data
DELETE
Remove data
π HTTP Status Codes
Every HTTP response includes a status code β a 3-digit number telling the browser what happened. They're grouped by their first digit:
1xx β Informational
100 Continue2xx β Success β
200 OK β everything worked201 Created β new resource made3xx β Redirection βͺοΈ
301 Moved Permanently304 Not Modified (use cache)4xx β Client Error β
400 Bad Request403 Forbidden404 Not Found β the classic!5xx β Server Error π₯
500 Internal Server Error503 Service Unavailableπ οΈ Chrome DevTools: Your X-Ray Vision
Chrome DevTools (and similar tools in Firefox/Safari) let you see everything happening under the hood. As a web developer, you'll use them constantly.
Key DevTools Tabs
Elements
Inspect and edit the live HTML & CSS of any page. See the DOM tree, modify styles in real-time, and debug layout issues.
Network
See every HTTP request the browser makes β HTML, CSS, JS, images, API calls. Inspect headers, status codes, and response times.
Console
Run JavaScript directly, see errors and warnings, and log messages from your code. Your debugging best friend.
Responsive Mode
Toggle device toolbar to test how your page looks on phones, tablets, and different screen sizes.
π Try it yourself!
- Open DevTools right now (F12)
- Click the Network tab
- Reload this page (Ctrl+R)
- Watch all the HTTP requests appear! Click on any to see headers and response
π Module Summary
The address to find any resource on the web (protocol + domain + path + query + fragment).
Sends requests, receives HTML/CSS/JS, and renders the visual page you see.
Stores files and data, processes requests, and sends back responses.
Translates human-readable domain names into machine-readable IP addresses.
The protocol for communication. Methods (GET, POSTβ¦) + Status codes (200, 404β¦).
Your X-ray vision into any web page β inspect HTML, network traffic, and run JS.