1. How the Web Works
How the Web Works
Before writing a single line of code, you need to understand what actually happens when you type a URL into a browser and press Enter. The answer is more elegant than you might think.
🌍 The Client-Server Model
The web is built on a client-server relationship. Your browser (the client) sends a request across the internet to a server — a powerful computer sitting in a data center somewhere in the world. The server reads the request, finds the right files, and sends them back.
BrowserIP AddressGET /index.htmlHTML + CSS + JSVisible Page✨ The Holy Trinity of the Web
Every webpage is built from three technologies working together in perfect harmony:
The skeleton — defines structure and content
The skin — controls visual appearance
The muscles — adds interactivity and logic
🔄 HTTP — The Language of the Web
Browsers and servers communicate using HTTP (HyperText Transfer Protocol). When your browser asks for a page, it sends an HTTP GET request. The server replies with a status code:
- 200 OK — Everything worked perfectly
- 404 Not Found — The page doesn't exist on the server
- 500 Internal Server Error — Something broke on the server
- 301 Moved Permanently — The URL has changed, follow this new one
🛠️ Tools You Need
- VS Code — The most popular code editor, free from Microsoft
- Chrome DevTools — Press F12 in any browser to inspect any website's code live
- Live Server extension — In VS Code, this auto-refreshes your browser every time you save a file
Knowledge Check
Ready to test your understanding of 1. How the Web Works?