Computer Science › Section E · Networking and the internet › Topic E.3
The World Wide Web
The web is the part of the internet most people see: pages linked to other pages, fetched by a browser in a fraction of a second. Behind every page sit three simple ideas, an address called a URL, a request protocol called HTTP and a markup language called HTML.
The web is not the internet
The internet is the global network infrastructure; the World Wide Web is one application that runs on it. Tim Berners-Lee proposed the web at CERN, the European physics laboratory, in 1989, and his first software was working by the end of 1990. It combined three pieces that still define the web: a document format with embedded links to other documents (hypertext), a protocol for fetching such documents, and a server that hands them out on request. Email, online games and video calls also use the internet without being part of the web.
Browsers, webservers and HTTP
Web software comes in two kinds. A browser runs on the user's device, fetches what the user asks for and displays it. A webserver, such as the open-source Apache or Nginx, runs on a machine holding web documents and supplies them to browsers. The two talk using the Hypertext Transfer Protocol (HTTP), so the web follows the client/server model: the browser is the client. HTTPS is HTTP carried over an encrypted connection, explained in the topic Cybersecurity: encryption and authentication. Many web standards are developed by the World Wide Web Consortium (W3C), which Berners-Lee founded in 1994.
URLs
Every resource on the web has a uniform resource locator (URL), which tells a browser how and where to fetch it. A URL has a scheme (the protocol, such as https), then the host name of the server, then an optional port number after a colon, then a path naming the directory and the document. It may end with a query, data for the server after a question mark. If the path is left out, the server returns a default document, usually the site's home page. Most browsers also fill in the scheme if you type only a host name.
Worked example: reading a URL
Take https://shop.example.com:8443/catalog/boots/hiking.html?size=42. 1. The scheme is https, so the browser will use HTTP over an encrypted connection. 2. The host is shop.example.com, which a DNS lookup turns into an IP address. 3. The port is 8443; without it, the browser would use the standard HTTPS port, 443. 4. The path /catalog/boots/ names a directory on the server, and hiking.html is the document. 5. The query size=42 is passed to the server, which might use it to show only boots in that size. Check: removing the port and query leaves https://shop.example.com/catalog/boots/hiking.html, which still names the same page on the standard port.
HTTP requests and responses
To fetch a page, the browser sends a request such as GET /catalog/boots/hiking.html HTTP/1.1 followed by headers, including Host: shop.example.com. GET asks for a resource; POST sends data, such as a completed form. The server answers with a status line, headers and usually the content. Status codes are grouped by first digit: 200 means OK; 301 means the resource has moved permanently; codes in the 400s are client errors, such as 404, not found; codes in the 500s are server errors, such as 500, a general failure inside the server. Each request is handled on its own, so sites use small stored values called cookies to recognise a returning user.
HTML: marking up a page
A web page is a text file written in Hypertext Markup Language (HTML). Besides ordinary characters, it contains tags in angle brackets that say what each part of the text is. Most come in pairs: <p> opens a paragraph and </p> closes it. A page sits inside <html> and </html> and has two sections. The head, between <head> and </head>, holds information about the page, such as its <title>, which browsers show on the tab rather than in the page. The body, between <body> and </body>, holds what is displayed, such as headings marked <h1> and paragraphs marked <p>. The browser reads the tags and lays out the page accordingly.
Links and images
Hyperlinks are what make the web a web. An anchor tag turns text into a link: <a href="https://example.org/routes.html">routes</a> shows the word routes, and clicking it makes the browser fetch the URL given in the href (hypertext reference) attribute. An image is placed with <img src="map.png" alt="Trail map">. The src attribute gives the image's location, and the alt attribute gives a text description for screen readers and for when the image fails to load. The img tag has no closing tag. A relative address such as map.png is interpreted relative to the page's own URL.
Worked example: what a browser fetches
A club's page at https://example.org/club/index.html contains <h1>Hiking club</h1><p>See our <a href="routes.html">routes</a>.</p><img src="map.png" alt="Trail map">. 1. The browser looks up example.org through DNS and sends GET /club/index.html. 2. It receives 200 OK and the HTML, and starts laying out the heading and paragraph. 3. Reading the img tag, it resolves map.png against the page's URL to https://example.org/club/map.png and sends a second GET for the image. 4. The link fetches nothing yet; only when the user clicks it does the browser request https://example.org/club/routes.html. Check: one page needed two requests, one for the HTML and one for the image.
Client-side and server-side activity
Many pages do more than display fixed text. Work done by the browser is client-side; work done by the server is server-side. Programs written in JavaScript are embedded in or linked from a page and run in the browser, for example to check that a form is complete before it is sent, or to update part of a page without reloading it. Style sheets in CSS control colours and layout. On the server, programs written in languages such as Python or PHP build customised pages, such as a search engine's results. Older client-side systems, Java applets and Flash, are no longer supported by modern browsers. Either side running the other's code is a security risk, so each must treat it with suspicion.
XML and markup by meaning
The Extensible Markup Language (XML) is not a page format but a standard style for designing markup languages: tags in angle brackets, matching closing tags with a slash, and attributes such as unit="kg". Languages built this way exist for mathematics, graphics and music. HTML was developed separately, from an older standard called SGML, so it does not follow every XML rule; XHTML is a variant that does. XML's tags can describe meaning rather than appearance. Marking a recipe line as <ingredient>spinach</ingredient>, not just as a list item, lets software find recipes that do or do not contain spinach.
Common mistakes to avoid
First, treating the internet and the web as the same thing. Second, thinking the title in the head appears on the page; it appears on the tab. Third, forgetting that every image is a separate request. Fourth, assuming any 4xx code is the server's fault; the 400s report client errors, the 500s server errors. Fifth, believing a link fetches its target when the page loads; it waits for a click. Sixth, calling HTML a dialect of XML, which is true only of XHTML.
Key takeaways
The web, proposed by Tim Berners-Lee at CERN in 1989, is an application running on the internet. Browsers request resources from webservers using HTTP, or HTTPS when encrypted. A URL gives the scheme, host, optional port, path and optional query. Requests use methods such as GET and POST, and responses carry status codes such as 200, 404 and 500. HTML tags mark up a page's head and body; anchors with href create links, and img with src adds images. JavaScript and CSS work on the client side; programs on the server build custom pages. XML is a standard for designing markup languages that can describe meaning.
Flashcards
Flashcard
Linked documents and applications fetched over the internet
Test your understanding
Question 1 of 5
In the URL https://news.example.net/sport/2026/final.html, what is news.example.net?
Question 2 of 5
A browser requests a page and the server replies with status code 404. What happened?
Question 3 of 5
Which piece of HTML makes the word maps into a link to https://example.org/maps.html?
Question 4 of 5
Which of these is a server-side activity?
Question 5 of 5
Which statement about XML is correct?
