How a browser requests a page
- The browser parses the URL into scheme, host, port, path and query.
- DNS resolves the hostname to a network address.
- HTTPS establishes an encrypted, authenticated connection.
- The browser sends an HTTP request.
- The server returns a status, headers and a body.
- The browser parses HTML and requests linked CSS, JavaScript, fonts and images.
Requests and responses
GET /roadmap.html HTTP/2
Host: hafizrich.com
Accept: text/html
HTTP/2 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300Headers carry metadata. The body carries the representation: HTML, JSON, an image or another media type.
Status codes describe outcomes
| Range | Meaning | Examples |
|---|---|---|
| 2xx | Successful | 200 OK, 201 Created |
| 3xx | Redirect or cache | 301 Moved, 304 Not Modified |
| 4xx | Request-side problem | 400 Bad Request, 404 Not Found |
| 5xx | Server-side failure | 500 Internal Server Error |
Browser DevTools
Use Elements for DOM and CSS, Console for JavaScript output, Network for requests and timing, Sources for breakpoints, and Accessibility inspection for names and roles.
Debug systematically: reproduce, observe, isolate, form a hypothesis, change one variable, and verify.
Basic web security
Treat all input as untrusted. Use HTTPS, escape output, validate on the server, keep secrets out of browser code, avoid injecting untrusted HTML and update dependencies deliberately.