Behind the Scenes: The Process of Retrieving a Webpage
When we type a URL (Uniform Resource Locator) into our web browser, it may seem like a simple and straightforward process, but there is actually a lot happening behind the scenes. In this post, we'll take a look at the series of events that occur when we type a URL into our browser and hit "enter."
The first step in the process is called "DNS resolution." When we type a URL into our browser, the browser needs to know the IP address of the server that hosts the website we're trying to access. The domain name system (DNS) is responsible for translating domain names (e.g. www.example.com) into IP addresses. So, when we type in a URL, the browser sends a request to the DNS to resolve the domain name into an IP address. To determine the website's related IP address, the browser looks for DNS entries in the cache. It looks for the cache listed below. If it isn't there in one, look in the next one till it is.
- Browser Cache
- Operating Systems
- Cache Router
- Cache ISP Cache
The browser will establish a connection with the server that matches the IP address once it has the right IP address in order to transfer data. Internet protocols are used by browsers to create these connections. Once the browser has the IP address, it establishes a TCP (Transmission Control Protocol) connection with the server. TCP is a protocol that ensures that the data being sent between the browser and the server is received correctly. This is done by dividing the data into smaller packets, and then sending them individually to the server. The server acknowledges the receipt of each packet, and the browser retransmits any packets that aren't acknowledged. This process is known as a "TCP handshake" and it establishes a reliable connection between the browser and the server.
After the TCP connection is established, the browser can then send an HTTP (Hypertext Transfer Protocol) request to the server. The server then receives the HTTP request and processes it. It looks for the requested webpage and any other resources (such as images or stylesheets) that the webpage needs in order to be displayed properly. The server then sends a response back to the browser, which includes the HTML (Hypertext Markup Language) code for the webpage, as well as any other resources that were requested.
The browser then receives the response and begins to render the webpage. It starts by parsing the HTML code and using it to create a Document Object Model (DOM) of the webpage. The DOM is a tree-like structure that represents the different elements of the webpage and how they're related to each other. Once the DOM is created, the browser can then use it to display the webpage on the screen.
Finally, the browser may also send requests for additional resources such as images, javascript files, and CSS files. The browser will then parse those resources to make the final webpage you see.In summary, when we type a URL into our browser, a series of events occur in the background to retrieve the requested webpage. The browser sends a request to the DNS to resolve the domain name into an IP address, then sends an HTTP request to the server at that IP address, receives the HTML code and other resources, parses the HTML to create a DOM, and finally displays the webpage on the screen.
Publish date: 19 January 2023
References:
- https://chat.openai.com/
- https://www.geeksforgeeks.org/what-happens-when-we-type-a-url/
- https://medium.com/@maneesa/what-happens-when-you-type-an-url-in-the-browser-and-press-enter-bb0aa2449c1a
- https://blog.bytebytego.com/p/what-happens-when-you-type-a-url
- https://midjourney.com/




Comments
Post a Comment