Study Guide
How a Web Page Is Loaded
What happens between typing a web address and seeing the page: the browser, a DNS lookup that returns the IP address, a request to the web server, the HTML coming back and being rendered; and how cookies, session and persistent, let a website recognise a browser, with their privacy risks.
Lesson 4.7 Networks, the Internet and Security
For: Cambridge IGCSE Computer Science learners, or anyone who has wondered what a browser does in the moment before a page appears
Stage: Think
The pause before the page
Mia is in her school library. She types https://www.example.org/science/magnets.html into the address bar of a browser and presses Enter. A second later a page about magnets appears. The school and the website are fictional.
Think it through
In that second, a lot of things must happen between the browser and other computers. List, in order, what you think happens between pressing Enter and the page appearing.
- Hint 1: The page is stored on a computer somewhere else. How does the browser find that computer?
- Hint 2: What does the browser have to ask for, and what comes back?
Show a model answer
There is no single right list yet, but a good one has these ideas: the browser has to find the computer that holds the page; it has to ask that computer for the page; the computer has to send the page back; and the browser has to turn what comes back into something you can see. This lesson fills in each part.
Stage: Discover
Names for people, numbers for computers
When you call a friend, you tap their name in your contacts. The phone network does not connect names, though: it connects numbers. So the phone looks the name up in the contacts list and uses the number it finds.
Think it through
Mia typed a domain name, www.example.org. Computers on the internet are found by their IP addresses, which are numbers. What does the browser need to do before it can contact the website, and where might it get what it needs?
- Hint 1: What did the phone do with the friend’s name?
- Hint 2: Where could a very large list of names and numbers be kept?
Show what happens
The browser needs the IP address that belongs to the domain name, like a number for a name. It cannot work that out itself, so it needs a list to look it up in, kept on some other computer.
That list is held by a domain name server, also called a DNS server (DNS stands for domain name system). Its job is to hold records that link domain names to IP addresses, and to give the IP address back when it is asked for a domain name. A DNS server is like a huge, always up-to-date contacts list for the internet. If the first DNS server asked has no record of a name, it asks other DNS servers on the browser’s behalf.
The computer that stores the website and sends out its pages is the web server. It has an IP address, and the DNS server’s record says what that address is. Here are three records from a fictional DNS server, using addresses set aside for examples:
| Domain name | IP address |
|---|---|
| www.example.org | 203.0.113.25 |
| learn.example.com | 198.51.100.7 |
| shop.example.com | 203.0.113.80 |
Check your understanding
Show the answer
Answer: A. 203.0.113.25, the IP address of the web server.
The DNS server returns an IP address. It never holds the page.
Stage: Predict
Put the journey in order
You now know every part of the journey: the browser, the DNS server, the IP address, the web server and the HTML. Six things happen when Mia presses Enter, but they are listed below in a mixed-up order.
| What happens | Order |
|---|---|
| The web server sends the HTML for the page back to the browser | |
| The browser reads the URL and picks out the domain name | |
| The browser renders the HTML and shows the page | |
| The DNS server sends the IP address back to the browser | |
| The browser sends a request for the page to the web server | |
| The browser asks a DNS server for the IP address that goes with the domain name |
- The browser cannot contact the web server until it knows the IP address.
- The page cannot be shown until its HTML has arrived.
Show the completed table
| What happens | Order |
|---|---|
| The web server sends the HTML for the page back to the browser | 5 |
| The browser reads the URL and picks out the domain name | 1 |
| The browser renders the HTML and shows the page | 6 |
| The DNS server sends the IP address back to the browser | 3 |
| The browser sends a request for the page to the web server | 4 |
| The browser asks a DNS server for the IP address that goes with the domain name | 2 |
Write a number from 1 to 6 in each blank cell.
Each step names the device that acts. Check each one against the order you chose.
Mia’s browser
Step 1 of 6: It reads the URL
The browser splits the URL. The protocol is https, the domain name is www.example.org and the page is science/magnets.html. The domain name is what it needs to look up.
Mia’s browser
Step 2 of 6: It asks the DNS server for the IP address
The browser sends the domain name to a DNS server, because it can only contact a web server by its IP address.
Technical detail: The school network tells each device which DNS server to use when the device joins the network.
The DNS server
Step 3 of 6: It looks up the name and sends back the IP address
The DNS server finds the record for www.example.org and sends back its IP address, 203.0.113.25.
Technical detail: If this server has no record, it asks other DNS servers. If none knows the name, the browser shows an error such as “server not found”.
Mia’s browser
Step 4 of 6: It sends a request to the web server
Using the IP address, the browser sends a request for science/magnets.html to the web server. The request travels as packets, passed on by routers.
The web server at 203.0.113.25
Step 5 of 6: It finds the page and sends back the HTML
The web server finds the file and sends its HTML back to the browser, again as packets.
Technical detail: If the server has no such file, it sends back an error message instead, such as “404 Not Found”.
Mia’s browser
Step 6 of 6: It renders the HTML and shows the page
The browser works out what each tag in the HTML means and draws the page about magnets. If the page needs images, the browser requests them from the web server in the same way.
Stage: Explain
Following one request
Liam types https://learn.example.com/maths/fractions.html. Use the three DNS records from earlier.
- Read the URL. The protocol is https, the domain name is learn.example.com, and the page is maths/fractions.html. The browser needs the domain name, because that is what the DNS server stores records for.
- Ask the DNS server. The browser sends “learn.example.com” to the DNS server. Why: the browser has a name, and it needs the number to contact a computer.
- Read the reply. The DNS server finds the record: learn.example.com has the IP address 198.51.100.7. Why this one and not 203.0.113.25: the records link each name to exactly one address, and 203.0.113.25 belongs to www.example.org.
- Send the request. The browser sends a request for maths/fractions.html to 198.51.100.7. Why: that is where the web server for this domain name is.
- Receive and render. The web server sends back the HTML, and the browser renders it. Liam sees the page.
Apply it
Show the answer
Answer: C. 203.0.113.80, because that is the record for shop.example.com.
The whole domain name matters: shop.example.com has its own record, and its own web server.
Apply it
Show the answer
Answer: A. The browser has to get the IP address from a DNS server first, as it cannot contact the web server without it.
The DNS server comes first, because the browser needs the web server’s IP address before it can ask the web server for anything.
Apply it
Show the answer
Answer: D. The DNS lookup failed, as the DNS server has no record for the misspelt domain name.
No record means no IP address, so the browser never gets as far as asking a web server for the page.
Stage: Think
A shop that forgets you
Fatima is looking at a fictional online shop. She adds a pair of trainers to her basket, then opens another page to look at socks. The basket on the new page still shows the trainers.
Each request a browser sends is separate, and a web server does not remember by itself who sent the previous one.
Think it through
How could the shop’s web server work out that the second request comes from the same browser as the first, so that it shows the same basket? Hint: what could the browser carry with it?
- Hint 1: Think of a cloakroom ticket: you hand in your coat and keep a number.
- Hint 2: Where could a number be kept while Fatima moves between pages?
Show a model answer
The server can give the browser a small piece of information, like a cloakroom ticket, and ask the browser to keep it and send it back with every later request. The server then matches the ticket to the right basket.
That ticket is a cookie: a small text file that a website asks a browser to store. Whenever the browser asks the same website for another page, it sends the cookie back with the request, so the website can recognise it.
Fatima’s browser
Step 1 of 5: It asks for a shop page for the first time
The browser has no cookie from this shop yet, so it sends none.
The shop’s web server
Step 2 of 5: It sends the page and asks for a cookie to be stored
With the page, the server sends a cookie that holds a code, for example basket=A7Q3. The code is made up by the shop for this visit.
Fatima’s browser
Step 3 of 5: It stores the cookie
The browser saves the cookie in its cookie store, filed under the shop’s website.
Fatima’s browser
Step 4 of 5: It sends the cookie back with her next request
Fatima adds the trainers. The request for this carries the code A7Q3. The server finds the basket linked to that code and adds the trainers to it.
The shop’s web server
Step 5 of 5: It recognises the browser on every later page
The request for the socks page carries the same code, so the server shows the same basket, with the trainers in it.
A cookie lets a website remember a browser. The uses in the specification are:
- saving personal details: a name or address typed into a form, so that it is filled in next time;
- tracking user preferences: the language chosen, a dark or light theme, the text size;
- holding items in an online shopping cart (a basket), as in Fatima’s example;
- storing login details, so that a user stays logged in as they move around the site. A well-built website stores a code that identifies the login, not the password itself.
Check your understanding
Show the answer
Answer: C. Tracking user preferences.
A remembered choice, such as a language, is a user preference.
Stage: Discover
How long should a cookie last?
Think it through
Fatima closes her browser. Should the basket still be full when she opens it tomorrow? Should the site still remember her language choice? Should her bank still keep her logged in? Give a reason for each.
- Hint 1: Which of these would be dangerous on a shared computer?
- Hint 2: Which would annoy her if it were forgotten every day?
Show a model answer
Many people would say that the basket may be forgotten when the browser closes, the bank must not keep her logged in, but a language choice is useful to keep for a long time. Different information needs to last for different lengths of time.
That is the difference between two kinds of cookie:
- a session cookie has no expiry date. It exists only during the browsing session, and is deleted when the browser is closed. It suits things that should not outlast the visit, such as a shopping basket or a bank login;
- a persistent cookie has an expiry date. It stays on the device after the browser is closed, until that date arrives or the user deletes it. It suits things that should last, such as a language preference or a “keep me logged in” choice.
Do not confuse: How long a cookie lasts
- No expiry dateSession cookie
- Deleted when the browser is closed, so it only lasts for one visit.A basket, or a bank login.
- Has an expiry datePersistent cookie
- Stays on the device after the browser closes until it expires or is deleted.A saved language, or a “remember me” login.
| What the cookie does | Session or persistent? |
|---|---|
| Holds the items in a basket until the browser is closed | |
| Remembers a chosen dark theme when the pupil returns next month | |
| Keeps a user logged in to an online bank until the window is closed | |
| Fills in the pupil’s name on a form for the next thirty days |
- Should it still exist after the browser is closed?
Show the completed table
| What the cookie does | Session or persistent? |
|---|---|
| Holds the items in a basket until the browser is closed | session |
| Remembers a chosen dark theme when the pupil returns next month | persistent |
| Keeps a user logged in to an online bank until the window is closed | session |
| Fills in the pupil’s name on a form for the next thirty days | persistent |
Write session or persistent in each blank cell.
Apply it
Show the answer
Answer: B. A session cookie ends when the browser closes; a persistent cookie has an expiry date and lasts until then.
The difference is when the cookie ends: with the browser closing, or at an expiry date.
Stage: Explain
Cookies and privacy
Cookies are useful, but they hold information about a person, and sometimes many websites share it.
- Hint 1: Who uses the computer next?
- Hint 2: Which kind of cookie is still there after the browser is closed?
Show a model answer
The next person to use the computer could open the same website and find the pupil already logged in, able to see their personal details and messages. A persistent cookie keeps the login after the browser closes, which is what makes it risky on a shared device.
Things to think about with cookies:
- Personal data stored on a shared device. Saved names, addresses and logins can be seen by the next user. Log out and delete cookies on a computer that is not yours.
- Tracking. Some cookies come from advertising companies whose content appears on many websites. They can note which websites the same browser visits and build up a picture of a person’s interests.
- Consent. In the UK, a website must ask permission before it sets cookies that it does not need in order to work, and a user can say no. Basket cookies are usually allowed without asking, because the basket cannot work without them.
- User control. A user can see, delete and block cookies in the browser’s settings. Deleting them also removes saved baskets and logins.
A cookie is plain text data. It is not a program, so it cannot run on a device or carry a virus. The worry about cookies is about privacy, because of what they let a website remember and what they let other companies learn.
Apply it
Show the answer
Answer: D. The company may track which websites the same browser visits and build a profile of the person.
Cookies from a company that appears on many sites can be used to follow one browser from site to site.
Stage: Consolidate
Show what you know
Think it through
Explain to a friend what happens from typing a URL to seeing the page. Use the words browser, domain name, DNS server, IP address, web server, HTML and render.
- Hint 1: Start with what the browser has: only a name.
- Hint 2: End with what the browser does with the HTML.
Show a model answer
A good answer: “The browser takes the domain name from the URL and asks a DNS server for the IP address that goes with it. The DNS server looks the name up and sends the IP address back. The browser then uses the IP address to send a request to the web server, which sends back the HTML of the page. The browser renders the HTML and shows the page.”
Apply it
Show the answer
Answer: B. The DNS server found no IP address for the second domain name, so the browser had nowhere to send its request.
The lookup is a separate step, and each website has its own record.
Apply it
Show the answer
Answer: C. A session cookie, because it is deleted when the browser is closed.
A session cookie ends with the browser, so a shared computer is left logged out.
- When a URL is entered, the browser takes the domain name, asks a DNS server for the matching IP address, sends a request to the web server at that address, receives the HTML, and renders it.
- A DNS server holds records linking domain names to IP addresses. If it has no record, the lookup fails and no request is sent.
- A cookie is a small text file stored by the browser and sent back to the website with later requests, so the site can recognise the browser. Uses include saving personal details, tracking preferences, holding a shopping cart and storing login details.
- A session cookie has no expiry date and is deleted when the browser closes; a persistent cookie has an expiry date and stays until then or until it is deleted.
- Cookies raise privacy concerns: data left on shared devices, tracking across websites, and the need for consent. A cookie is text, not a program.
Sources and scope
- What this lesson is. The seventh lesson of the Networks, the Internet and Security module, written for this site. Its curriculum links are provisional: the wording of each linked specification point has been checked against the published specification, but no link has been verified by the site owner, and the links imply no endorsement by any examination board. The links were written against the Cambridge IGCSE Computer Science 0478 specification for 2026 to 2028.
- Original material. Mia, Liam, Priya, Noah, Fatima, Jonas, the school library, the shop, the news website and the cookie code A7Q3 are fictional. The domain names (example.org, example.com) and the addresses 203.0.113.x and 198.51.100.x are reserved for examples in documents, so they never belong to a real website or device.
- Simplified on purpose. Real lookups often involve a chain of DNS servers and stored copies of answers, and a browser or router may remember recent answers. A real basket may be held entirely in the server or partly in the cookie. The lesson shows one common design. The law on cookies is summarised for the UK and varies elsewhere. Browsers and websites also use other ways to recognise a visitor, which are not taught.
A server that holds records linking domain names to IP addresses and returns the IP address for a domain name it is asked about.
The readable name of a website’s host, such as www.example.org, which a domain name server turns into an IP address.
The language in which the structure and content of a web page is written, which a browser renders into the page you see.
The worldwide infrastructure of linked networks, cables, routers and servers that carries data between devices.
An address allocated by a network to a device on it, used to deliver packets to that device.
Any information about an identifiable living person, such as a name, address, photo, medical note or school record.
The text-based address of a web page, which can contain the protocol, the domain name and the page or file name.
Software that requests web pages, then renders their HTML and displays them to the user.
A computer that stores the files of websites and sends a web page to a browser when it receives a request for it.
The collection of websites and web pages that can be reached using the internet.
Your progress on this lesson
Saved in this browser only. It is not sent anywhere, does not follow you to another device, and is lost if you clear this site’s data.
This browser is not allowing the site to save progress, so it will be forgotten when you leave the page.