What happens when you enter a URL

Jonathan Hakimian
3 min readMar 25, 2021

--

This article will cover the entire process by which a webpage displays something within your browser.

When you open up a browser, you are running a program that exists on your local computer. It will open a window on your local display. When you type in a URL and hit enter, your browser undertakes a number of interactions with the internet to get the HTML file it needs to render within its browser window.

First thing the browser needs to know, where on the internet does it go to find the given url. It executes the Domain Name Service (DNS) protocol. Has this address been visited recently? If not, the browser will ask the operating system to translate the URL into an IP address. If the operating system has not seen that url before, the Internet Service Provider (ISP) will check whether or not it has seen that request before.

https://dev.to/deepika_banoth/what-happens-when-i-type-a-url-in-browser-3i5o

Eventually we get a definitive IP address. That gets returned to the ISP, which passes it back to the operating system. The operating system sends the IP address to the browser, which uses that translation to find the correct information on the internet. Then the browser executes a second request for the actual HTML document using the IP address and domain name. The ISP accesses a chain of computers, which is where the internet gets its power from.

When the browser makes a request, the internet will route it to the destination specified by the IP address. The computer on the other side of the chain looks at the domain name requested, along with the resource requested from it, and evaluates the request using a web server. Typically web servers are programs like Apache, Nginx, and Microsot-IIS.

https://media.geeksforgeeks.org/wp-content/uploads/20190927155217/webserver.png

Whichever web server is running on the remote client, receives the HTTP request on a particular port (ex. port 80, port 443) and tries to resolve it. If the web server is not designed to deliver files, it may need to construct the HTML text on the fly. The web server will decide what content should be put in to the HTML document based on who made the request.

A website like ‘amazon.com’ might fill out that HTML document with some advertisements, recommended products, or information from your previous visit. The web server then returns the HTML document that has tags, tree structure, attributes and content. It travels back across the internet, and the web browser receives that text document and creates a tree structure internally in the browser. From there it renders a visual representation of what the HTML demonstrated.

At that point the web browser’s job is done, and it waits for the user to interact with the page that is drawn. Until that happens, the web browser does nothing but render the page as it was delivered.

That is the basic end to end story of how the web browser gets content and delivers it back. Hopefully this gives you a better idea of what happens when you enter a URL.

--

--

No responses yet