What happens when you type google.com in your browser and press Enter
In a rapidly evolving digital era, we use the internet for just about anything, and everything; from studying and research to connecting with family and friends through the various social media platforms, to playing online games, watching movies, and listening to new hit songs, among other things.
With a global upsurge in the access and use of the internet, many people continue to wonder how they are able to access all sorts of information by just clicking on URLs or typing simple phrases into web browser search bars. In this article, I focus on explaining what happens when you type
https://www.google.com (or any other URL) in your browser and press
First things first:
- Web pages
For the benefit of understanding our subject, let me share a ‘little’ background knowledge on a few concepts. Let’s start with what a webpage is. A webpage is basically a text file formatted a certain way so that your browser (i.e. Google Chrome, Firefox, Safari, etc.) can understand it; this format is called Hyper Text Markup Language (HTML). Webpages are kept in computers that provide the service of storing files until someone who needs them is able to access them upon request. These computers are called servers. It’s so because they serve the content that they hold to whoever needs it.
Servers vary in classes, with the most common and the one that we’ll be talking about in this article being a web server; the server that serves web pages. There is also application servers, the ones that hold an application base code that will then be used to interact with a web browser or other applications. The other servers are database servers, the ones that hold a database that can be updated and consulted when needed.
In order to deliver their content, these servers, much like in physical courier services, need to have an address so that the person needing said content can make a “letter” requesting the delivery; the person requesting the content in turn also has an address where the server can deliver the content to. These addresses are called IP (Internet Protocol) Address; a set of 4 numbers that range from 0 to 255 (one byte) separated by periods (i.e. 18.104.22.168).
3. TCP/IP & UDP
Another concept that is important to know is that the courier service traffic for the delivery can be one of two: Transmission Control Protocol (TCP) or User Datagram Protocol (UDP). Each one determines the way the content of a server is served, or delivered.
TCP is usually used to deliver static websites such as Wikipedia or Google and also email services and to download files to your computer because TCP makes sure that all the content that is needed gets delivered. It accomplishes this by sending the file in small packets of data and along with each packet a confirmation to know that the packet was delivered; that’s why if you are ever downloading something and your internet connection suddenly drops when it comes back up you don’t have to start over because the server would know exactly how many packets you have and how many you still need to receive. The downside to TCP is that because it has to confirm whether you got the packet or not before sending the next, it tends to be slower.
UDP, on the other hand, is usually used to serve live videos or online games. This is because UDP is a lot faster than TCP since UDP does not check if the information was received or not. The only thing UDP cares about is sending the information. That is the reason why if you’ve ever watched a live video and if either your internet connection or the host’s drops, you would just stop seeing the content; and when the connection comes back up you will only see the current stream of the broadcast and what was missed is forever lost. This is also true for online video games.
Back to what actually happens . . .
Here is what actually happens when you type
https://www.google.com in your browser and press
The first thing that happens is that your browser looks up in its cache to see if the website was visited before and the IP address is known.
If it can’t find the IP address for the URL requested then it asks your operating system to locate the website. The first place your OS is going to check for the address of the URL you specified is in the hosts file (/etc/hosts in Linux and Mac, c:\windows\system32\drivers\etc\hosts in Windows).
If the URL is not found inside the file above, then the OS will make a DNS request to find the IP Address of the web page. The first step is to ask the Resolver (or Internet Service Provider) server to look up in its cache to see if it knows the IP Address, if the Resolver does not know then it asks the root server to ask the .COM TLD (Top Level Domain) server — if your URL ends in .net then the TLD server would be .NET and so on — the TLD server will again check in its cache to see if the requested IP Address is there. If not, then it will have at least one of the authoritative name servers associated with that URL, and after going to the Name Server, it will return the IP Address associated with your URL.
In our modern society when everything is online, it is amazing to know the complexity that takes place in order for us to be able to get to a website. Yet, it is done so fast that very few would even begin to fathom the amazing process that takes place.
I hope this brief article has given you more insight of everything that happens “under the hood” when you type
https://www.google.comin your browser and hit Enter.
Thank you for reading!
Server (computing) https://en.wikipedia.org/wiki/Server_(computing)#Hardware_requirement
How DNS works https://howdns.works/
TCP vs UDP https://www.diffen.com/difference/TCP_vs_UDP
How to edit your hosts file https://www.howtogeek.com/howto/27350/beginner-geek-how-to-edit-your-hosts-file/