DEV Community

Cover image for How does the browser work?
Victoria
Victoria

Posted on

How does the browser work?

The task of the browser is to load and display the page:
Alt Text
URL (Uniform Resource Locator) is a pointer to a resource: a website, a document, an image, a video.

What happens when a user requests a resource?

0. The browser splits the URL into parts:

Alt Text

1. DNS Resolution

Using DNS browser converts habr.com to the IP address:
Alt Text
DNS (Domain Name System) is a system that
converts a domain name (google.com, habr.com) to the IP address.

2. TCP connection:

Alt Text
Using the IP address the browser establishes a connection with the host to start exchanging traffic.

TCP (Transmission Control Protocol) is a protocol that establishes a reliable connection between two hosts.

3. The browser can request the necessary resource from the server using HTTP:

Alt Text
HTTP (Hypertext Transfer Protocol) is a specific format of messages between the client (browser) and the server.

The server receives the request, then sends it to the database to take the requested data from there, forms it in a certain format (HTML, XML, JSON) and gives it to the browser.

Or returns an error:

  • 1xx — informational answer
  • 2xx — successful execution (200 OK)
  • 3xx — redirection
  • 4xx — client error (400 — bad request, 404 — not found)
  • 5xx — server error

Top comments (0)