HOW DOES WEB WORK?

Dushani Ranasinghe
4 min readSep 17, 2021

In our day-to-day life, we search for almost everything on the internet using web browsers. All you have to do is just type the URL or the website’s name into your browser and the relevant website will load up in your browser in a split second. Awesome! Isn’t it? However, have you ever wondered how that all works?

Imagine you want to visit a website like medium.com. You open whatever browser* you like and enter this address. The moment you hit the ENTER button, your browser sends a request to the server* of the website. This process includes several steps.

  • Browser is a software that is used to access the internet (i.e. Google chrome, Mozilla Firefox).
  • The machine that provides services to your machine is called “Server” while your machine which is used to connect to those services is called “Client”.
Search medium.com on the browser

#1 STEP

The address medium.com you entered is called the domain name. This domain name is a part of the website’s URL*.

  • URL (Uniform Resource Locator) is a global address of documents and other resources on the internet. In simple terms, we use URLs to tell the browser what website we want to visit.

URL consists of 3 basic components. They are,

Scheme/protocol: HTTP is a set of rules for the transfer of data on the world wide web

Domain: Website name

Path: Address to the resource within site folders

Once the URL is entered into the browser, the browser contacts Internet Service Provider and then DNS* (Domain Name System).

  • DNS: Domain Name System is like a dictionary or a phonebook of the internet. It manages the mapping between domains and IP addresses.

DNS translates domain to the IP address*.

  • IP address: Internet Protocol address is used to uniquely identify a device on the internet.
DNS Translates the domain to the IP address

#2 STEP

Once the DNS translates the domain to the IP address, the browser sends an HTTP* request called “GET” to the server asking for a copy of the website.

  • HTTP: HyperText Transfer Protocol which is used to exchange hypertext messages between clients and servers over the internet.

After receiving the IP address, the server reads the request and checks the data for the IP address specified by the browser, by pulling data from the database.

If the request is successful, the server sends an HTTP response to the browser/client that includes HTML* documents(resource files) the browser asked for.

If there’s any problem with the request, server sends an error code as the response.

  • HTML file: HTML file includes HyperText Markup Language which is also known as HTML. HTML is used to create the structure of a web page.

#3 STEP

Once the source file arrived at the browser, it parses* the HTML file.

  • Parsing an HTML file means extracting relevant pieces of information in the HTML code such as paragraphs, headings, links.

#4 STEP

After parsing the HTML file, the browser fetches other linked resource files to the HTML file and assembles them into a document.

First fetch images, videos, and other media files, then style sheets: to style the document, and finally, JavaScript files: to provide on-page functionality.

At the end of the process, the browser renders a visible page and displays it in the browser.

So, That’s how you can see all those attractive websites in all over the internet.

The whole thing might happen in a blink of an eye, but now you know it’s more than that. I didn’t go into way more detail about this complex process. However, I believe at the end of this article, you have at least a rough idea of what actually happens behind websites.

THANK YOU!

--

--