What the web is and how web applications work
Every time you open a website, watch a video or send a message in a browser, you are using the web. This lesson explains the basic idea: the browser (client) asks, the server answers – and everything comes out of that, from a simple page to applications such as YouTube and Gmail.
How to learn: try every example in the browser or on the command line and do the exercises from the lesson. The examples are in HTML, JavaScript and Python; for most of them a browser is enough, and for the Python examples you need Python 3 installed.
The internet and the web are not the same
| Internet | Web (World Wide Web) | |
|---|---|---|
| What it is | a network that connects computers all over the world | a set of pages and applications that open in a browser |
| Examples of use | email, video calls, games, the web, IoT devices | websites, online shops, social networks |
| Created | 1969 (ARPANET), today's form in 1983 | 1989–1991, Tim Berners-Lee (CERN) |
| Basic protocol | TCP/IP | HTTP / HTTPS |
So the web is one of the services that run over the internet. How the internet finds computers is explained in the next lesson, How the internet works.
Client and server
Every communication on the web has two sides:
| Role | Who it is | What it does |
|---|---|---|
| client | a browser (Chrome, Firefox, Edge, Safari) or a mobile app | sends a request and shows the response |
| server | a program on a computer that is always on and connected to the internet | receives the request, processes it and returns a response |
BROWSER (client) SERVER
┌─────────────────┐ request: give /index.html ┌──────────────┐
│ │ ─────────────────────────▶ │ │
│ shows the │ │ finds or │
│ page │ ◀───────────────────────── │ builds the │
└─────────────────┘ response: an HTML page │ response │
└──────────────┘
Comparison with a restaurant: you (the client) order, the waiter takes the order to the kitchen (the server), the kitchen prepares the meal and the waiter brings it. You do not go into the kitchen – you only get the finished meal.
Static site, dynamic site, web application
| Kind | How the page is made | Example |
|---|---|---|
| static site | the server sends ready-made HTML files – everyone gets the same thing | a personal site, documentation, this site with lessons |
| dynamic site | the server builds the page for every request (often from a database) | news, a forum, competition results |
| web application | the page behaves like a program: sign-in, input, saving data, real-time work | Gmail, Google Docs, an online classroom, Petlja |
The boundary is not sharp: a static site can also have JavaScript that makes it interactive, and a web application can also have static parts.
What a web application is made of
| Part | Where it runs | Technologies |
|---|---|---|
| frontend – what the user sees | in the browser | HTML (structure), CSS (appearance), JavaScript (behaviour) |
| backend – logic and data | on the server | Python (Django, Flask), C# (ASP.NET Core), JavaScript (Node.js), Java, PHP |
| database | on the server | SQL databases (PostgreSQL, MySQL, SQLite), other databases |
| API – the agreement on how the frontend and the backend exchange data | between them | HTTP + JSON |
Each of these parts has its own lesson: Frontend and backend, What an API is.
What happens when you type an address – in short
- From the address (
https://svetprogramiranja.com/introduction_to_the_web) the browser reads the name of the server. - Through DNS it finds out the IP address of that server.
- It sets up a connection and sends an HTTP request.
- The server returns an HTTP response – an HTML page.
- The browser reads the HTML, also requests the CSS, JavaScript and images, and then draws the page.
All of that takes a fraction of a second. Each step is explained in detail in the lessons How the internet works and The HTTP protocol.
Exercise: look at what the browser does
The browser's tools (DevTools): in Chrome, Edge and Firefox they open with the F12 key (or right click → Inspect). The most important tabs are Elements (the page's HTML and CSS), Console (JavaScript messages and errors) and Network (all the requests the page sends).
- Open any page of this site and press F12.
- Choose the Network tab and reload the page (F5).
- Look at the list: how many requests were sent? Which are HTML, which CSS, JS, images (the Type column)?
- Click the first request (the document itself) and look at the Status – it should say
200.
One "ordinary" page usually sends dozens of requests – one for each file.
- "Web" and "internet" are not synonyms – the web is a service that runs over the internet.
- The browser does not "have" the site – it asks the server for it every time (or takes it from its temporary memory, the cache).
- The frontend runs on the user's side, the backend on the server – passwords and important rules are never checked only in the frontend.
Check your knowledge
Open the quiz
Introduction to the web
1. What is the client in web communication?
2. What is the difference between a static and a dynamic site?
3. Which language defines the structure of a web page?
4. Who invented the web?
