๐ How the Internet Works
Before learning HTML, CSS, and JavaScript, it's important to understand what actually happens when you open a website.
You don't need to understand every technical detail yet. We'll build the understanding step by step.
1๏ธโฃ What Is the Internet?
The Internet is a global network of connected computers and devices that communicate with each other.
Your phone, laptop, web servers, and millions of other devices can communicate through the Internet.
For example:
Your Phone
โ
Internet
โ
Web Server
โ
Website
When you open a website, your device communicates with another computer called a server.
2๏ธโฃ What Is a Server?
A server is a computer that provides resources or services to other computers over a network.
A web server can store and deliver the files and data required for a website.
For example, a website might have:
HTML files
CSS files
JavaScript files
Images
Videos
Other data
When you request a webpage, the server sends the required information back to your browser.
3๏ธโฃ What Is a Client?
The client is the device or software making the request.
When you use Chrome, Firefox, Edge, or another browser to visit a website, your browser acts as a client.
For example:
Client Server
Browser โโโโโ Request โโโโโโ Web Server
Browser โโโโโ Response โโโโโ Web Server
This request โ response concept is fundamental to web development.
4๏ธโฃ What Happens When You Visit a Website?
Suppose you type:
example.com
into your browser.
A simplified version of what happens is:
Step 1 โ You enter the website address
You enter a URL into your browser.
Step 2 โ Your browser finds the server
The browser needs to determine where the website's server is located.
This involves a system called DNS, which we'll study separately.
Step 3 โ Browser sends a request
Your browser sends a request to the appropriate server.
Essentially:
"Please give me this webpage."
Step 4 โ Server processes the request
The server receives the request and determines what it needs to send back.
Step 5 โ Server sends a response
The server sends information back to your browser.
For example:
HTML
CSS
JavaScript
Images
Data
Step 6 โ Browser displays the webpage
Your browser reads the HTML, applies the CSS, runs the JavaScript, and displays the resulting webpage.
So the simplified process is:
You
โ
Browser
โ
Internet
โ
Server
โ
Response
โ
Browser
โ
Webpage
5๏ธโฃ Request and Response
This is one of the most important concepts to remember.
Request
A request is sent by the client asking the server for something.
For example:
"Give me the homepage."
Response
A response is what the server sends back.
For example:
"Here is the homepage and its required resources."
This happens constantly while you use websites.
When you click a button, submit a form, load a page, or request data, your browser may communicate with a server.
๐ Real-World Example
Imagine you're using an online shopping website.
You click:
"View Product"
Your browser might send a request:
Browser
โ
"Give me product information"
โ
Server
The server might retrieve the product information from a database:
Server
โ
Database
โ
Product information