HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
The Internet, the Web and How Pages Reach You
  1. 1The internet, the world wide web and URLs
  2. 2HTTP, HTTPS and the web browser
  3. 3Finding a web page: DNS, web servers and cookies
  1. Computer Science
  2. /The Internet, the Web and How Pages Reach You
  3. /Finding a web page: DNS, web servers and cookies

Course 5.1·Lesson 3 of 3

Finding a web page: DNS, web servers and cookies

What happens between pressing Enter and seeing the page? This lesson follows the steps: the browser, the domain name server, the IP address, the web server and the HTML. Then it explains cookies, session and persistent, and what websites use them for.

about 30 min1 simulation1 practice question
Lesson 3 of 3Show all lessonsHide
The Internet, the Web and How Pages Reach You
  1. 1The internet, the world wide web and URLs
  2. 2HTTP, HTTPS and the web browser
  3. 3Finding a web page: DNS, web servers and cookies

Try the code and the simulations beside the lesson.

From a URL to a page on the screen

You type www.example.org/news.html and press Enter. Less than a second later, the page is on your screen. Let us slow that second down.

The browser has a problem. It knows the domain name, but computers on the internet find each other by IP address. So the first job is to turn the name into a number. That is the job of a domain name server (DNS). A DNS is a server that holds a list of domain names and the IP addresses that go with them. It works like the contacts list on a phone, where you find a number by a name.

Three boxes: the web browser at the bottom left, a domain name server (DNS) at the top, and the web server at the bottom right. Numbered arrows show the order. Arrow 1 goes from the browser to the DNS with the domain name. Arrow 2 goes from the DNS back to the browser with the IP address. Arrow 3 goes from the browser to the web server with a request. Arrow 4 goes from the web server back to the browser with the page in HTML. A note at the browser says that it renders the HTML.

Here are the steps, in order.

  1. The user types the URL into the address bar of the web browser, or clicks a link.
  2. The browser sends the domain name to a DNS.
  3. The DNS looks up the domain name and finds the matching IP address. If it does not hold that name, it asks another DNS, and that one can ask another.
  4. The DNS sends the IP address back to the browser. If no DNS knows the name, the browser shows an error.
  5. The browser uses the IP address to send an HTTP or HTTPS request to the web server that holds the website.
  6. The web server finds the page and sends it back to the browser as HTML, with its other files.
  7. The browser renders the HTML and displays the page.

In an exam, name every part: the browser, the DNS, the IP address, the web server and the HTML. Say who sends what to whom.

Why the second visit is faster

A DNS keeps a copy of the answers it has received from other servers. So the next time someone asks for the same domain name, the first DNS already knows it. Fewer servers are asked, and the page arrives sooner.

Cookies

You put two books into a basket on a shopping website and move to another page. The basket still holds the books. How does the website remember? A web server does not remember you from one request to the next. A cookie does that job.

A cookie is a small text file. A website sends it, and the web browser stores it on the user's device. Each time the browser asks that website for a page, it sends the cookie back. So the website can recognise the user.

There are two kinds.

  • A session cookie is kept only while the browser is open. It is held in memory and deleted when the browser is closed. It is used, for example, to hold the items in a shopping basket during one visit.
  • A persistent cookie is saved in the device's storage. It stays after the browser is closed, until its expiry date or until the user deletes it. It is used to remember a user from one visit to the next.

Websites use cookies for these functions.

  • Saving personal details, such as a name or an address, so a form fills itself in.
  • Tracking user preferences, such as the language of the site or a dark colour scheme.
  • Holding items in an online shopping cart while the user goes on shopping.
  • Storing login details, so the user stays logged in.

Cookies can also record which pages a user visits, and some are used to choose the adverts a user sees. That is why many websites ask before they store cookies. You can delete cookies in the browser settings.

Practise with new numbers

Try it in Python

The program acts as two domain name servers. The first is asked first. If it does not know a name, the second one is asked, and the first one keeps the answer for next time. Look at the third lookup.

Read it first. Then run it. Why is only one server asked for the last lookup?

1. Look up www.example.com, which neither server knows. What does the program print?

2. Add www.example.com to other_dns with the IP address 192.0.2.44. Run it again.

Common mistakes

  • Saying the DNS sends the web page. The DNS only sends the IP address. The web server sends the page.
  • Getting the order wrong. The DNS comes before the web server, because the browser needs the IP address first.
  • Saying cookies are programs. A cookie is a small text file. It cannot run.
  • Mixing up the two kinds of cookie. A session cookie goes when the browser closes. A persistent cookie stays until it expires or is deleted.

Remember these

  • The browser sends the domain name to a DNS, and the DNS returns the IP address.
  • The browser sends a request to the web server at that IP address. The server sends the HTML, and the browser renders it.
  • A DNS that does not know a name asks another DNS.
  • A cookie is a small text file that a website stores on the user's device through the browser. Session cookies last for one visit. Persistent cookies stay until they expire or are deleted.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. What does the domain name server send back to the browser?
  1. Put these in order: the web server sends HTML; the DNS returns the IP address; the browser renders the page; the browser sends the domain name to the DNS.
  1. On a first visit, 333 DNS servers are asked, each taking 15 ms15\ \text{ms}15 ms, and the web server takes 90 ms90\ \text{ms}90 ms. How long until the page arrives?
  1. Lena closes her browser and opens it again. The website still knows her chosen language. Which kind of cookie did that?
  1. Give two things that websites use cookies for.

Enroll free in The Internet, the Web and How Pages Reach You

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (4)

A user types www.example.org/maps.html into a browser and presses Enter…Medium · High School (9–10) · by StemPy Lab
On a first visit to a website, the browser's domain name server does not know the name…Medium · High School (9–10) · by StemPy Lab
A weather website stores a persistent cookie that remembers a user's home town…Hard · High School (9–10) · by StemPy Lab
That was the last lessonBack to the course: take the test
← The Internet, the Web and How Pages Reach You
← HTTP, HTTPS and the web browserNext →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

An online bookshop uses two cookies. Cookie A holds the books in the shopping basket while the user…Hard · High School (9–10) · by StemPy Lab

Python Labs (1)

A domain name server and a web serverPython Lab · by StemPy Lab

Question Sets (1)

The Internet and the Web: Check Your Understanding10 questions · by StemPy Lab

Notes (1)

The Internet and the Web: Quick RevisionNote · by StemPy Lab