Every day, we use websites such as Google, YouTube, Facebook, Amazon, and Wikipedia. Behind every website is a combination of technologies that allows computers to communicate over the Internet.
Before learning HTML, CSS, JavaScript, and modern web frameworks, it is important to understand how the Web works and how a webpage travels from a server to your browser.
By the end of this lecture, you should understand:
The Internet is a global network that connects billions of computers and devices around the world.
It allows devices to exchange information regardless of their physical location.
Today, we use the Internet to:
The Internet is the infrastructure that makes all of these services possible.
Many people think the Internet and the World Wide Web (WWW) are the same, but they are different.
The Web is only one service provided by the Internet.
Other Internet services include:
Internet = Road Network
World Wide Web = Cars travelling on those roads
Or,
Internet = Infrastructure
Web = Websites running on that infrastructure
When you open a website, your computer does not communicate directly with the destination computer.
Instead, data passes through many networking devices called routers.
A router's job is to:
Computer
↓
Router
↓
Router
↓
Router
↓
Server
If one route becomes unavailable, routers automatically choose another route.
This makes the Internet reliable and efficient.
Large files are not sent all at once.
Instead, data is divided into smaller units called packets.
Photo
↓
Packet 1
Packet 2
Packet 3
Packet 4
Each packet contains:
Packets may travel through different routes before reaching their destination.
The receiving computer reassembles all packets into the original file.
Computers communicate using a standard set of rules called TCP/IP.
TCP/IP consists of two main protocols:
Every device connected to the Internet has a unique IP Address.
Examples:
192.168.1.10
8.8.8.8
An IP address identifies where data should be sent.
IPv4 uses 32 bits and contains four numbers separated by dots.
Example:
192.168.0.1
Each number ranges from:
0–255
IPv4 supports approximately 4.3 billion unique addresses.
Because IPv4 addresses are limited, IPv6 was introduced.
IPv6 uses 128 bits, allowing an enormous number of unique addresses.
Example:
2001:0db8:85a3::8a2e:0370:7334
TCP ensures reliable communication.
Its responsibilities include:
Without TCP, files could arrive incomplete or in the wrong order.
A single computer can run many Internet services at the same time.
Ports help identify which service should receive incoming data.
| Port | Service |
|---|---|
| 80 | HTTP |
| 443 | HTTPS |
| 21 | FTP |
| 22 | SSH |
| 25 | SMTP |
When data is transmitted, it includes:
This ensures data reaches the correct application.
Computers communicate using IP addresses.
However, humans prefer easy-to-remember names.
Instead of typing:
142.250.193.78
we type:
google.com
The Domain Name System (DNS) converts domain names into IP addresses.
google.com
↓
DNS Server
↓
142.250.xxx.xxx
DNS is often called the Phonebook of the Internet.
When a device joins a network, it needs several network settings before it can communicate.
Instead of configuring these settings manually, DHCP automatically assigns:
Without DHCP, every device would need to be configured manually.
A Web Browser is software that allows users to access websites.
Popular browsers include:
A browser is responsible for:
A Web Server is a computer or software that stores websites and delivers them to users.
Examples include:
When a browser requests a webpage, the server sends the required files back to the browser.
Browsers and servers communicate using HTTP.
HTTP (HyperText Transfer Protocol) defines how requests and responses are exchanged.
HTTPS (HyperText Transfer Protocol Secure) is the secure version of HTTP.
HTTPS encrypts communication using SSL/TLS, protecting sensitive information such as passwords and payment details.
A URL (Uniform Resource Locator) identifies the location of a resource on the Web.
https://www.example.com/folder/file.html
| Component | Description |
|---|---|
https:// |
Protocol |
www.example.com |
Domain Name |
/folder/ |
Path |
file.html |
Resource |
.com.org.edu.gov.netWhen you visit a website, several steps happen automatically.
1. User enters www.example.com
↓
2. Browser checks DNS
↓
3. DNS returns the server's IP address
↓
4. Browser connects to the server
↓
5. Browser sends an HTTP request
↓
6. Server processes the request
↓
7. Server returns HTML, CSS, JavaScript, Images
↓
8. Browser renders the webpage
This entire process usually takes only a few milliseconds.
The Web follows a Request–Response Model.
The browser sends a request to the server.
Example:
GET / HTTP/2
Host: www.example.com
Meaning:
Please send me the homepage.
The server processes the request and returns the requested resource.
Example:
HTTP/2 200 OK
Content-Type: text/html
The browser then renders the webpage for the user.
Every HTTP response includes a status code indicating the result of the request.
| Code | Meaning |
|---|---|
| 200 | OK |
| 301 | Moved Permanently |
| 302 | Found |
| 304 | Not Modified |
| 307 | Temporary Redirect |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
The requested resource does not exist.
Example:
example.com/page-that-does-not-exist
An unexpected error occurred on the server while processing the request.
This usually indicates a problem with the application's code or server configuration.