A web browser is a program that fetches resources from the network, interprets them and draws the result, while running untrusted code from every site you visit. It is a rendering engine, a script engine, a network stack and a security sandbox in one, and understanding it explains most of how the web behaves.
Key concepts
- Rendering pipeline: parse HTML into a tree, compute styles, lay out boxes, paint, and composite layers.
- Script engine and event loop: JavaScript runs on one thread, taking turns with rendering and input.
- Same-origin policy: a page may not freely read data from another origin; this is the core of web security.
- Storage and cache: cookies, local storage and the HTTP cache keep state between visits.
- Process isolation: sites and tabs are separated so a failure or an exploit stays contained.
Vocabulary
- Origin: the combination of scheme, host and port that defines a trust boundary.
- Engine: the core that renders pages; several browsers can share one.
- Developer tools: built-in panels to inspect the DOM, network, performance and storage.
- Reflow: recomputing layout after something changes.
What to study, in order
- Open the developer tools on any page and read its elements, network and console panels.
- Watch a page load in the network panel, and explain the order of requests and what blocks what.
- Read how a browser turns markup into pixels, from parsing to compositing.
- Experiment with cookies and the same-origin policy on a test page of your own.
- Check how your page behaves in at least two different engines.