How the web works
You use the web every day, but have you ever wondered what actually happens when you type an address and press enter? In this lesson we'll follow that journey from start to finish. You don't need to remember every detail. The goal is to have a rough picture in your head, because it makes everything else in this pathway easier to understand.
Browsers and servers
There are two main characters in this story.
The browser is the program you use to visit websites. Chrome, Firefox, Safari and Edge are all browsers. Its job is to ask for web pages and then show them to you.
The server is a computer somewhere in the world that stores a website and sends it to anyone who asks for it. It's not a special magic machine. It's just a computer that's always on and always connected to the internet.
When you visit a website, your browser sends a message to a server that basically says "can I have this page, please?" The server sends the page back, and your browser displays it. This back and forth is called a request and a response.
What does a server do?
Select one answer
What a URL actually is
A URL is the address of something on the web. You've typed thousands of them. Let's take one apart:
https://www.example.com/blog/my-first-post
- https:// tells the browser how to talk to the server. The "s" at the end means the connection is secure, so nobody in between can read what's being sent.
- www.example.com is the domain. It's the name of the website, a bit like the name on a front door.
- /blog/my-first-post is the path. It tells the server which page on the website you want.
Computers don't actually find each other by name. They use numbers called IP addresses, which look something like 93.184.215.14. Since nobody wants to remember numbers like that, there's a system called DNS that works like the internet's phone book. It looks up the domain name and finds the matching number for your browser.
In the URL https://www.kurser.app/discover, which part is the domain?
Select one answer
The journey of a web page
Now let's put the pieces together. Here's what happens when you type an address and press enter:
- You type
https://www.example.cominto your browser - The browser asks DNS for the IP address of
www.example.com - DNS answers with the number
- The browser sends a request to the server at that address
- The server finds the page and sends it back as a response
- The browser reads what it got and draws the page on your screen
All of this usually happens in less than a second. Every single time you click a link.
The three languages of the web
So what exactly does the server send back? Every web page is built from three languages, and each one has its own job.
HTML is the structure and content. It decides what's on the page: headings, paragraphs, images, links and buttons. Think of it as the skeleton of a house.
CSS is the styling. It decides how things look: colors, fonts, spacing and layout. This is the paint, the furniture and the decorations.
JavaScript is the behavior. It decides what happens when you interact with the page, like opening a menu or showing a message when you click a button. This is the electricity that makes the lights turn on.
Here's a tiny taste of each one. Don't worry about understanding them yet, just notice how different they look:
<h1>Hello, world!</h1> <p>This is my very first web page.</p>
h1 {
color: purple;
font-size: 48px;
}alert('You clicked the button!');You'll learn all three in this pathway, one at a time and in that exact order. That's the order most developers learn them in, because each one builds on the one before.
You want to change the color of a heading. Which language do you use?
Select one answer
You can peek behind the curtain
Here's something fun: every website you visit sends its HTML, CSS and JavaScript to your browser, which means you can look at it.
In most browsers you can right click anywhere on a page and choose Inspect. A panel opens with something called the developer tools. It looks overwhelming at first, but you're seeing the actual code of the page.
You don't need to understand any of it yet. Just knowing it's there is enough for now. We'll come back to the developer tools later, because they're one of the most useful things you'll learn to use.
Open your favorite website, right click on a heading and choose Inspect.
Look at the panel that opens and try to find the text of the heading you clicked on. It'll be surrounded by things like <h1> or <h2>. That's HTML.
Now try changing the text directly in the panel by double clicking it. Type something silly and press enter. The page changes, but only on your screen. Reload the page and everything goes back to normal. You can't break anything this way, so play around as much as you like.