What happens when you type google.com in your browser and press Enter

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 Enter.

First things first:

  1. 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.

2. Servers

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. 125.0.0.1).

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 Enter:

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.

After the OS has the IP Address and gives it to the browser, it then makes a GET (a type of HTTP Method) to said IP Address. When the request is made the browser again makes the request to the OS which then, in turn, packs the request in the TCP traffic protocol we discussed earlier, and it is sent to the IP Address. On its way, it is checked by both the OS’ and the server’s firewall to make sure that there are no security violations. And upon receiving the request the server (usually a load balancer that directs traffic to all available server for that website) sends a response with the IP Address of the chosen server along with the SSL (Secure Sockets Layer) certificate to initiate a secure session (HTTPS). At last, the chosen server sends the HTML, CSS, and JavaScript files (If any) back to the OS which in turn gives it to the browser to interpret it. It is as this point that you get the website as you know it.

Conclusion

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!

Resources

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/

--

--

--

Frontend Software Developer with experience in projects related to web development (HTML, CSS, Bootstrap, JavaScript), and App development (Node.js, React).

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to run your own Aeternity node on Amazon AWS

We already know the precise #socialmedia recipe Google loves. https://t.co/9p5c6f7i8M

Need faster code? Try Multithreading

AvaDice x Fief Guild Partnership

Releasing a desktop app for windows, mac and linux with github actions

Monitoring your StaFi and SaFiHub Validator

Two Interesting Resources

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ojo Timilehin Joseph

Ojo Timilehin Joseph

Frontend Software Developer with experience in projects related to web development (HTML, CSS, Bootstrap, JavaScript), and App development (Node.js, React).

More from Medium

Publish Website with “GitHub Pages” for Free

My favorite success story about Agora.

Creating a Firebase Project with ES5 Javascript on Mac & Saving to GitHub

My Top 3 Free MacOS Menu Bar Apps