The internet is not the web
The internet is the global network of interconnected networks — the physical and logical infrastructure that carries data between machines. The world wide web is a collection of pages and resources accessed over that infrastructure.
One is the roads; the other is one kind of traffic on them. Email, file transfer, video calls and online games all use the internet without being part of the web at all. Confusing the two is the single most commonly examined distinction in this topic.
| Term | Meaning |
|---|---|
| Internet | the global infrastructure of connected networks |
| World wide web | pages and resources accessed over the internet |
| URL | the address of a resource: protocol, domain, path |
| HTTP / HTTPS | the protocol carrying web pages; HTTPS is encrypted |
| DNS | the system translating a domain name into an IP address |
| Browser | the software that requests, renders and displays pages |
| ISP | the company providing the connection to the internet |
What a browser does
A browser does considerably more than display pages. It sends the request, receives the response, interprets the HTML into a structure, applies the CSS, runs the JavaScript, manages the history and bookmarks, and stores cookies.
It also renders the result. The same page can look slightly different in different browsers, because each interprets ambiguous cases in its own way — which is why web developers test in several.
Describe what happens between typing a web address and the page appearing.
- The browser extracts the domain name from the URL and asks a DNS server for its IP address.The network routes by numeric address, not by name.
- The DNS server returns the IP address, or asks another DNS server if it does not know it.DNS is a hierarchy of servers, not a single lookup table.
- The browser sends an HTTP request to that IP address asking for the page.
- The web server responds with the HTML, and the browser then requests each stylesheet, image and script the page refers to.This is why a page with many images loads in stages.
- The browser parses the HTML into a structure, applies the CSS and runs the JavaScript, then renders the result.Only at this point does anything appear on screen.
DNS lookup, HTTP request, server response, further requests for resources, then parsing and rendering.
Why DNS exists
Machines are addressed by IP number, but numbers are impossible to remember and change when a site moves to a different server. DNS lets a memorable name point at whichever address is current, so a site can move servers without anyone needing to learn a new address. It is essentially the internet's phone book.
Cookies
A cookie is a small text file a website stores on the visitor's machine, sent back to that site on each subsequent visit. It is how a stateless protocol remembers anything at all.
Session cookies are held in memory and deleted when the browser closes — they keep you logged in as you move between pages of a site. Persistent cookies are stored on disk and survive until they expire, remembering preferences, a shopping basket, or that you have already seen a notice.
The concern is tracking. A cookie set by an advertiser appearing on many different sites can build a picture of the visitor's browsing across all of them, which is why browsers now restrict third-party cookies and why consent notices exist.
A cookie is data, not a program
It is a small text file. It cannot run, cannot access other files, and cannot carry a virus. The genuine concern is privacy — what can be inferred from the record of where you have been — rather than any direct harm to the machine. Answers claiming cookies infect computers are a standing error.
HTTP and HTTPS
HTTP carries requests and responses between browser and server as plain text, so anyone positioned between the two can read and alter it. HTTPS is the same protocol with the traffic encrypted, using a digital certificate issued to the site by a trusted authority.
The certificate does two jobs: it supplies the public key used to set up the encryption, and it vouches that the site is who it claims to be. The padlock a browser shows means the connection is encrypted and the certificate is valid — it does not mean the site is honest, only that it is genuinely the site whose name is on the certificate.
Before you leave this chapter
- The internet is the infrastructure; the web is one kind of content carried on it.
- DNS translates a domain name into an IP address, so sites can move without changing name.
- A browser requests, parses, applies CSS, runs JavaScript and renders.
- Cookies are text files, not programs — the concern is privacy, not infection.
- HTTPS encrypts using a certificate; the padlock proves identity and encryption, not honesty.
What the browser receives and what it does with it
The server sends back plain text — HTML, and separately the stylesheets and scripts the page refers to. Everything visible is constructed by the browser from that text, which is why the same page can look slightly different in different browsers.
The HTML is parsed into a tree of elements. The CSS is then applied to that tree, deciding how each part looks. Finally the JavaScript runs, able to change any part of the tree while the page is open. Three separate stages, in that order.
Switch from HTML to CSS to JavaScript. The structure is built first, styled second, and only JavaScript can change anything after the page has loaded.
Why pages load in stages
Each image, stylesheet and script is a separate request to the server. A page with forty images makes forty-one requests in total, and the visible content appears as each response arrives. That is why a page can show its text before its pictures, and why reducing the number of separate files is one of the main ways of making a site load faster.