How the web works?

RMAG news

Highly recommend to read my “How the Internet works?” article before reading this, as some complex terms like TCP/IP, packets and IP adress are explained there.

What is World Wide Web?🕸️

World Wide Web (WWW) – is a system of interconnected public webpages accessible through the Internet according to specific rules of Hypertext Transfer Protocol (HTTP).

It was created by Tim Berners-Lee in 1989. The main idea of the World Wide Web was to help scientists share information easily by using linked documents that could be accessed on the Internet. It easily gained popularity due to its user-friendly nature, allowing people to easily access and share information.

Dont’t confuse the World Wide Web with the Internet, as the Internet is a huge network that allows services like WWW to work.

World Wide Web (WWW) fundamentally relies on the client-server model.

Typically the client is web browser that requests web content from a server. And server processes the request, retrieve the necessary data and sends it to client.

Basic terms of the WWW🌐

Web browser is a software application used to access and view web pages (Chrome, Firefox, Safari).

Web Page is a document written in HTML (Hypertext Markup Language) that can contain text, images, videos, and links to other web pages. It can be styled using CSS (Cascading Style Sheet) and have dynamic behaviour using JS (JavaScript).

Web server is a software that serves web content (HTML, CSS, JS, PDF files, images etc). It can either serve static or dynamic content. Static content is any file that is stored on server and is the same every time it is delievered to users. Dynamic content is generated based on users data, behaiviour or other context.

URL (Uniform Resource Locator) is the address used to access a web page. For example, “http://example.com/about“. It contains of few parts:

Protocol (“http://” or “https://”)
Domain name (“example.com”)
Path (“/about”)

DNS (Domain Name System) is like a phonebook for the Internet. It translates human-friendly domain names (like “example.com”) into computer-readable IP addresses (like “192.0.2.1”).

HTTP (Hypertext Transfer Protocol) is a protocol that governs how data is transmitted between a web browser and a web server. HTTP message specifies HTTP method (“GET”), target URL, HTTP version and other data.

Example of HTTP request:

GET /index.html HTTP/1.1
Host: www.example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Accept-Encoding: gzip, deflate, br
Connection: keep-alive

How the web page gets to user?🎯

User enters URL of website or clicks on the link.
Browser sends URL to DNS server taht responses with IP adress of web server where website is hosted.
Browser send an HTTP request to received IP adress for content of web page.
Server receives and processes the request
If everything is OK, server responds with “200” status. Only after this, server starts sending files in form of packages. (First packet is always HTML)
After receiving first piece of data, browser starts its rendering process. (Critical Rendering Path).
Browser displays ready web page.

Summary📝

World Wide Web is a system of interconnected web pages that allows to easily share information all over the world using HTTP.

Thank you for reading, leave a comment if you want and remember that you can do everything you put your mind on!💖