When you open a web page, your browser (the client) asks a web server for the files, the server sends them back, and the browser displays them. You should be able to put these steps in order and say what each one does.
This lesson builds on reading a URL and belongs to the internet security module.
What are the steps from address to page?
Suppose you type https://www.example.com/index.html.
- The browser reads the URL. It splits it into protocol, host name and path.
- The browser asks a DNS server for the IP address that belongs to
www.example.com. - The DNS server replies with an IP address, for example
203.0.113.5(a documentation address, not a real site). - The browser sends a request to that address, asking for
/index.html, using the protocol (HTTPS). - The web server finds the file and sends a response containing the page content (HTML), plus any images or style files the page names.
- The browser renders the page, turning the HTML into what you see, and may request more files.
A browser does the reading, requesting and displaying. A server does the storing and responding.
Worked example
Order the steps and name the device doing each one for the request http://www.school.example.edu/news.html.
Step 1: the browser (user’s device) splits the URL: protocol http, host www.school.example.edu, path /news.html.
Step 2: the browser sends the host name to a DNS server. The DNS server (a computer on the network) returns the IP address.
Step 3: the browser sends a request for /news.html to that IP address.
Step 4: the web server (the school’s computer) locates news.html and sends it back.
Step 5: the browser renders the HTML and shows the page.
A good exam answer names who does each step, because “the browser” and “the server” are different marks.
The mistake to watch for
Mistaken answer: “The browser sends the web address to the web server, which converts it to an IP address.”
The student gave the DNS job to the web server.
The web server hosts the website. Converting a name to an IP address is the DNS server’s job, and it happens before the request for the page is sent. The correction: browser asks DNS, DNS returns the IP address, then the browser asks the web server.
Check yourself
1. Which comes first: the browser requesting the page or the DNS lookup? Why?
Show answer
The DNS lookup comes first. The browser needs the server’s IP address before it can send the page request to the right place.
2. State what the web server sends back in response to a request.
Show answer
The requested page content, usually HTML, plus any other files the page needs such as images. The browser then renders them.
3. Which device is the client and which is the server when you open a page on your phone?
Show answer
The browser on your phone is the client. The computer that stores the website files and responds is the web server.
Where does this lead next?
Once the path of a request is clear, you can ask what happens if someone intercepts it, which leads to describing encryption. Try the mixed practice set afterwards. The safe Python reasoning sandbox is there for the small code-reading questions in this module.
Students who know the facts but order the steps unreliably sometimes just need a teacher to question them step by step, which is how we approach online one-to-one Computer Science tuition.