Uncovering the Mystery Behind URL Entry: A Journey Through the Browser

Utkarsh Ahuja
5 min readFeb 3, 2023

--

Photo by Glenn Carstens-Peters on Unsplash

Ever wondered what happens when you type a URL in your browser and hit Enter ?
End to end, the process involves the browser, your computer’s operating system, your internet service provider, the server where you host the site, and the services running on that server.

“Understanding the Concept of URL”

A URL (Uniform Resource Locator) is a unique address that specifies the location of a web page or resources on the internet and allows users to access it via the web browser.

Parts of URL,https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL

Scheme: It is the protocol (set method for exchanging or transferring data around a computer network ) that the browser must use to request the resource.
Domain Name: It is the memorable address and points to a specific server’s IP address. Each device on the Internet has a unique address called IP address. But numbers like this are hard to remember! That’s where domain names come in.
Path: Path on the server to the requested resource.
Port: A communication endpoint for internet services, specified by a unique number.

When you type a URL into your browser and hit enter, the browser initiates a series of steps to access the website.

“DNS Lookup: How Browsers Locate Websites”

DNS (Domain Name System) converts human-readable domain names into numerical IP addresses that computers can understand and use to communicate with each other. It acts as a kind of phonebook for the internet, providing a mapping between domain names and IP addresses and enabling users to access websites and other online resources using easy-to-remember names, instead of having to remember IP addresses.

One of the first steps is checking the cache. Cache stores data from previously accessed websites to make future requests for that data faster. By checking the cache first, the browser can quickly load a website if the data is already stored. This helps to improve the overall speed and efficiency of web navigation.

The 4-Step Cache Check Your Browser Conducts Before Loading a Website:

  1. Browser: Checking the browser cache for recently visited websites and stored DNS records.
  2. Operating System: Querying the operating system cache for DNS records stored by the OS.
  3. Router: Examining the router cache for relevant information.
  4. Internet Provider: Finally, search the Internet Service Provider (ISP) cache if the previous steps do not yield results.
How the IP address that is associated with the domain name

“Browser-Server Communication: The Initialization of a TCP Connection”

Once the browser has received the correct IP address for a website, it establishes a connection with the corresponding server.

In order for data to be transferred between your computer (acting as the client) and the server, a TCP (Transmission Control Protocol) connection must be established. This connection ensures that the data packets are accurately and efficiently transmitted between the client and server.

Establishing a TCP connection involves a process known as the TCP/IP three-way handshake. This process ensures that the client and server are both ready to exchange data and that the communication is established in a reliable and secure manner.

TCP 3-way HandShake

3 Steps of the TCP/IP Three-Way Handshake:

  1. SYN Request: The client sends a SYN packet to initiate the connection and ask if the server is open for new connections.
  2. SYN/ACK Response: If open, the server responds with a SYN/ACK packet acknowledging the client’s request.
  3. ACK Confirmation: The client sends an ACK packet to confirm the connection and establish the data transmission process.

And with that, the TCP connection is established and ready for data transmission!

“Browser Sends an HTTP Request: Initiating Communication with the Web Server”

Initiating Data Transfer: HTTP Request from the Browser Once the TCP connection has been established, data transfer can begin.
The browser will send an HTTP request to the web server, either a GET request to retrieve information such as a web page or a POST request if submitting form data or credentials.
The request will also contain various headers including information on the browser being used (User-Agent header), acceptable types of requests (Accept header), and a request to maintain the TCP connection for further requests.
Additionally, information stored in cookies for the domain will also be included in the request.

Example of an HTTP Request

“Server Sends an HTTP Response”

The server’s response to the browser’s HTTP request includes not just the requested web page, but also important additional information such as the status code, compression type (Content-Encoding), caching instructions (Cache-Control), cookies to be set, privacy information, and more.

Example of an HTTP Response

But, what do these status codes represent 🤔
● 1xx indicates an informational message only
● 2xx indicates the success of some kind
● 3xx redirects the client to another URL
● 4xx indicates an error on the client’s part
● 5xx indicates an error on the server’s part

“The Final Step: Browser Renders the HTML Content”

The browser’s rendering process of the HTML content happens in stages. Initially, it displays the basic HTML structure, and then it analyzes the HTML tags, sending out GET requests to retrieve any additional webpage elements like images, CSS stylesheets, and JavaScript files. The browser caches these static files for future use, optimizing the load time for subsequent visits to the same page.

After the browser receives and processes all the necessary resources, it then renders the final version of the web page and displays it to the user. The completed web page, with all its images, styles, and functionalities, can then be interacted with and enjoyed by the user.

--

--