What the web is and how web applications work

Lesson 1 of 8 · Web basics

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.

Before you start: required prior knowledge – programming tools.
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

InternetWeb (World Wide Web)
What it isa network that connects computers all over the worlda set of pages and applications that open in a browser
Examples of useemail, video calls, games, the web, IoT deviceswebsites, online shops, social networks
Created1969 (ARPANET), today's form in 19831989–1991, Tim Berners-Lee (CERN)
Basic protocolTCP/IPHTTP / 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:

RoleWho it isWhat it does
clienta browser (Chrome, Firefox, Edge, Safari) or a mobile appsends a request and shows the response
servera program on a computer that is always on and connected to the internetreceives 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

KindHow the page is madeExample
static sitethe server sends ready-made HTML files – everyone gets the same thinga personal site, documentation, this site with lessons
dynamic sitethe server builds the page for every request (often from a database)news, a forum, competition results
web applicationthe page behaves like a program: sign-in, input, saving data, real-time workGmail, 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

PartWhere it runsTechnologies
frontend – what the user seesin the browserHTML (structure), CSS (appearance), JavaScript (behaviour)
backend – logic and dataon the serverPython (Django, Flask), C# (ASP.NET Core), JavaScript (Node.js), Java, PHP
databaseon the serverSQL databases (PostgreSQL, MySQL, SQLite), other databases
API – the agreement on how the frontend and the backend exchange databetween themHTTP + 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

  1. From the address (https://svetprogramiranja.com/introduction_to_the_web) the browser reads the name of the server.
  2. Through DNS it finds out the IP address of that server.
  3. It sets up a connection and sends an HTTP request.
  4. The server returns an HTTP response – an HTML page.
  5. 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).

  1. Open any page of this site and press F12.
  2. Choose the Network tab and reload the page (F5).
  3. Look at the list: how many requests were sent? Which are HTML, which CSS, JS, images (the Type column)?
  4. 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.

Common mistakes and tips
  • "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?