Head office, Rana Pratap Bagh, Delhi011 2721 1512+91 97116 99511

How the web works: URL, HTTP, browser and server

Read the parts of a URL, see how a browser sends an HTTP request to a server and gets a response, and learn what HTTPS and status codes mean.

Get the whole book: Computers and coding for classes 9 and 10 (6 lessons, free to print)

Let us begin

The big idea

When you type an address and a page appears, a short conversation has happened between two computers: your browser (the client) and a server somewhere else. This lesson follows that conversation, from the URL you type to the page you see.

A URL (Uniform Resource Locator) is the address of a page. Take the address www.example.in/science/water-cycle.html with https written in front of it. The scheme, https, says which rules to use; it is followed by a colon and two slashes. The domain name, www.example.in, names the server. The path, /science/water-cycle.html, names the page on that server. Some URLs add a query after a question mark, such as ?q=rain, to pass extra information.

The browser first asks the DNS (Domain Name System) to turn the domain name into an IP address, because computers find each other by number, not by name. Then it sends an HTTP request to that server. HTTP (HyperText Transfer Protocol) is the agreed set of rules for asking for and sending web pages. The most common request is GET, which means "please send me this page".

The server finds or builds the page and sends back an HTTP response: a status code and the content. Code 200 means OK, here it is. Code 404 means not found. Code 500 means the server had an error. The content is usually HTML, the language that describes the page structure, along with images, styles and scripts the browser then fetches with more requests.

HTTPS is HTTP with encryption. The data between you and the server is scrambled so no one in between can read or change it. The padlock in the address bar shows the connection is encrypted. Always prefer https pages, especially when logging in.

Client and server exchanging an HTTP request and responseA laptop labelled browser (client) on the left and a server box on the right. An arrow from client to server carries GET /water-cycle.html. An arrow from server back to client carries 200 OK plus the HTML page. Above, a URL is split into scheme, domain and path with labels.https: www.example.in /science/water-cycle.html scheme domain (server) path (page on the server) browser Client your laptop or phone Server holds the pages GET /science/water-cycle.html 200 OK + the HTML page Before this, DNS turned www.example.in into an IP address.
The browser sends a request for a path; the server sends back a status code and the page.

Worked examples

See how it works

  1. Taking a URL apart

    Take the address www.ncert.nic.in/textbook.php?class=8, typed with the scheme https in front. It has scheme https, domain www.ncert.nic.in, path /textbook.php and query class=8. The query passes the value 8 for the name class to the server.

  2. One page load, step by step

    You type www.example.in/about. The browser asks DNS for the IP address of www.example.in and gets one, say 203.0.113.5. It sends GET /about to that address. The server replies 200 OK with the HTML. The browser reads the HTML, sees it needs a picture, sends another GET for the picture, and draws the page.

  3. Reading a status code

    You follow an old link and the page says 404 Not Found. The server was reached fine, but there is no page at that path; perhaps it was moved. If instead you see 500, the page exists but the server program failed while building it.

Try it at home

Play the browser and the server

You will need

  • Paper and a pencil
  • Three envelopes
  • Four or five sheets with short pretend pages written on them, each with a path like /home, /about, /menu

What to do

  1. One person is the server. They keep the pages in a box and write a list of their paths on the outside.
  2. The other person is the browser. Write a request on paper: GET /menu. Put it in an envelope and hand it over.
  3. The server looks for the page. If it exists, they write 200 OK on top and send it back in the envelope. If not, they send back a sheet saying 404 Not Found.
  4. Try a request for a page that is not in the box and see the 404 reply.
  5. Now write a URL on paper for one page, label its scheme, domain, path and query, and swap roles.

Practice sheet

Check what you learned

Write your answers in a notebook, or print this sheet and write on it. When you finish, mark your work with the answer key.

Practice sheet: How the web works: URL, HTTP, browser and server (Classes 9-10, Computers and coding)

  1. What do the letters URL stand for?
  2. In the address www.example.in/science/water-cycle.html (scheme https), what is the domain name?
  3. What is the path in that URL?
  4. What does DNS do?
  5. What does HTTP stand for, and what is a GET request?
  6. What does status code 200 mean? And 404?
  7. What is the difference between HTTP and HTTPS?
  8. In the address shop.example.com/search?q=shoes, what is the query?
  9. Which computer is the client and which is the server when you read a page on your phone?
  10. Why does a page with pictures cause more than one request?

Answer key

Answers: How the web works: URL, HTTP, browser and server

Do the practice sheet first, then check here. If an answer is different from yours, read the lesson again and try once more.

  1. Uniform Resource Locator.
  2. www.example.in
  3. /science/water-cycle.html
  4. It turns a domain name into an IP address so the browser can find the server.
  5. HyperText Transfer Protocol; GET asks the server to send a page.
  6. 200 means OK, the page was sent; 404 means not found.
  7. HTTPS encrypts the data between the browser and the server, so others cannot read or change it; HTTP sends it unscrambled.
  8. q=shoes (the part after the question mark).
  9. Your phone (the browser) is the client; the computer holding the page is the server.
  10. The HTML arrives first; each picture, style or script it needs is fetched with its own request.
WhatsApp us