How the web works

IGCSE Computer Science · The Internet and Its Uses

Internet and World Wide Web are not the same

the internetthe global network infrastructure — the cables, routers and protocols that connect computers worldwide
the World Wide Webthe collection of web pages and websites that are accessed using the internet

The internet is the road system; the web is the traffic travelling on it. Email, file transfer and online gaming also use the internet but are not part of the web.

The parts of a URL

A uniform resource locator has three parts:

$$\underbrace{\text{https://}}_{\text{protocol}}\ \underbrace{\text{www.example.com}}_{\text{domain name}}\ \underbrace{\text{/pages/index.html}}_{\text{file path and name}}$$

HTTP and HTTPS

HTTP is the protocol for transferring web pages. HTTPS is the same protocol with encryption added, using $\text{SSL}$ or $\text{TLS}$.

The single letter matters: with $\text{https}$, anyone intercepting the traffic sees only ciphertext. This is essential for passwords, card numbers and any personal data — and it is why browsers show a padlock.

The Domain Name Service

Computers find each other by IP address, a number. People remember names. The DNS bridges the two.

  1. the user types a domain name into the browser;
  2. the browser asks a DNS server for the matching IP address;
  3. if that server does not know it, it passes the request to another DNS server;
  4. the IP address is returned to the browser;
  5. the browser uses the IP address to request the page from the web server;
  6. the server sends the page back, and the browser renders it.

Note the browser's job: it does not store the pages. It requests them, then interprets the HTML and displays the result.

Cookies

A cookie is a small text file stored on the user's computer by a website.

session cookieheld in memory and deleted when the browser closes — used for a shopping basket during one visit
persistent cookiesaved on the hard disk and survives closing the browser — used to remember logins, language and preferences

Uses: saving preferences, keeping a user logged in, holding items in a basket, and tracking which pages a user visits for targeted advertising.

The last use is why cookies raise privacy concerns, and why sites must ask permission.

Digital currency and blockchain

Digital currency exists only electronically. Its problem is trust: without a bank, what stops someone spending the same coin twice?

Blockchain solves this with a decentralised digital ledger — a record of every transaction, copied across many computers.

Each block contains the transaction data, a timestamp, and a hash of the previous block. That last part is the key: changing an old block changes its hash, which breaks every block after it, so tampering is immediately visible.

Because the ledger is held on many computers rather than one, there is no single copy to attack or alter.

From domain name to displayed page — six steps BROWSER user types the name 1. asks for the domain's IP DOMAIN NAME SERVER looks up name → IP 2. if it doesn't know, asks another server 3. returns the IP address 4. uses the IP to request the page WEB SERVER holds the page 5. sends the HTML back 6. BROWSER RENDERS the page The browser does NOT store pages — it REQUESTS and then INTERPRETS the HTML. The domain name service exists because machines find each other by NUMBER while people remember NAMES.
A domain name server holds no web pages at all — it is only a phone book that turns names into numbers. The real page is on the web server.

Worked example: tracing the path of a web page

A person types a web address into a browser. Describe the steps from typing to the page appearing, and state clearly the browser's role.

Solution

Step 1 — the user types the domain name. The user enters an address of the form $\text{https://www.example.com/index.html}$.

This address has three parts: the protocol ($\text{https}$), the domain name ($\text{www.example.com}$), and the file path ($\text{/index.html}$).

Step 2 — the browser asks a domain name server. Computers do not find each other by name but by IP address, a string of numbers. So the browser sends the domain name to a domain name server to ask for the corresponding IP address.

Step 3 — lookup, possibly via several servers. If that domain name server has no record for this name, it passes the request on to another domain name server until it is found.

Step 4 — the IP address is returned. The browser receives the number it needs.

Step 5 — request the page from the web server. The browser uses that IP address to send a request to the right web server holding the page. The server sends back the page's HTML code.

Step 6 — the browser renders the page. The browser interprets the HTML code and displays the result as the page the user sees.

The browser's role — a point often misunderstood.

The browser does not store web pages. It does three things: sends requests, receives HTML code, and interprets that code to display it.

Similarly, a domain name server holds no web pages at all — it is only a phone book that turns names into numbers. The real page is on the web server.

The role of the “s” in $\text{https}$. It shows that the data exchanged is encrypted using $\text{SSL}$ or $\text{TLS}$, so anyone who intercepts it sees only ciphertext. The browser displays a padlock icon to indicate this.

Worked example: why a blockchain resists data tampering

Explain the problem that digital currency has to solve, how a blockchain solves it, and why altering an old block is detected immediately.

Solution

The problem to solve: trust.

With cash, handing a note to someone else means you no longer have it. With digital currency, a “coin” is only data — and data can be copied.

So what stops a person spending the same coin twice? The traditional answer is to have a bank in the middle keeping the ledger. But then everyone has to trust that bank, and it becomes a single point that can make mistakes or be attacked.

How a blockchain solves it.

It uses a decentralised digital ledger: a record of every transaction, copied across a very large number of computers.

Because there is no single copy, there is no single point to attack. To alter the ledger, an attacker would have to alter the record on the majority of machines at the same time — which is almost infeasible.

Why altering an old block is detected immediately.

Each block contains three things: the transaction data, a timestamp, and the hash of the previous block.

A hash is a value calculated from the entire contents of the block. Change even one character in the block and its hash changes completely.

Now suppose an attacker alters a transaction in block number $50$:

In other words, altering an old block forces you to recalculate the entire chain after it, and to do so on the majority of computers in the network faster than the network is creating new blocks.

That is why a blockchain is considered tamper-resistant: not because it is impossible to alter, but because the alteration is exposed immediately and the cost of hiding it is unaffordable.

Common mistake

Using the Internet and the World Wide Web interchangeably, as two names for one thing. They are two different things at two different layers. The Internet is the global network infrastructure — the cables, routers and protocols that connect computers. The World Wide Web is the collection of web pages that runs on that infrastructure. The Internet is the road system; the World Wide Web is the traffic running on the roads. The clearest evidence to give in an answer: email, file transfer and online gaming all use the Internet but are not web pages — if the two concepts were one, that could not be explained. The accompanying trap: thinking a domain name server holds web pages. It is only a phone book that turns a domain name into an IP address; the real page is on the web server, and the browser must ask the phone book first and only then go to fetch the page.

Key takeaway

The Internet is the network infrastructure; the World Wide Web is the collection of pages running on it — email uses the Internet but is not the web. A web address has three parts: protocol, domain name, file path. HTTPS is HTTP with encryption. The domain name service turns a name into an IP address because machines find each other by number while people remember names; the browser does not store pages but only requests them and then interprets the HTML. A session cookie is lost when the browser is closed, a persistent cookie is not. A blockchain resists alteration because each block contains the hash of the previous block.

← Programming languages and translators · All IGCSE Computer Science lessons · Practice IGCSE Computer Science questions (free, instant scoring) · Cyber security: threats and defences →