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

Table of contents

No heading

No headings in the article.

Congratulations! You successfully made a request from your browser to the server hosting this page and the response is on your screen now. Before discussing on what happens under the hood, I’d like to introduce some basic concepts.

Concepts

A webpage is a text file, which is a formatted in a way that can easily be interpreted by a web browser, e.g. Chrome, Firefox, etc. This format is called HTML (Hypertext Markup Language). The file is stored on a computer that provides the service of storing the files and waiting for someone to request from them. This computer is called a “server” and your computer/browser that is used to make the request is called a “client”. There are different servers, e.g. Web server, Application server and Database servers. Each of these servers has its own purpose on the web. The web server serves web pages. The application server is the server which holds the applications base code that then will interact with a web browser or other applications. A database server holds the database that can be updated or consulted when needed, e.g. DNS (domain name system) a database that maintains the name of the website URL on the internet and the particular IP address it links to. These servers usually have its own address, which is what the browser uses to send a request (a message to the server asking for a resource, e.g. a web page, image or video). Your computer has its own address, which is what the server uses to send a response to it. These addresses are called IP address which is a set of 4 numbers that ranges from 0 to 255 (1 byte) separated by periods e.g. (127.0.0.1). Asides IP, there are other important protocols for transmitting information to the browser. These are called TCP (transmission control protocol) and UDP (user Data gram protocol). Each of these determines the way the content of the server is being served on the browser. TCP is used to deliver static websites like Wikipedia, google or email and to download files because TCP makes sure all content is delivered is completely intact. It accomplishes this by sending information in small packets and along which each packet has a confirmation to know if the packet is delivered. The downside to TCP is that because it requires confirmation on each packet, it is slower. UDP is used to stream music, videos and livestreaming of content. This is because UDP is a lot faster than TCP, as it does not require any confirmation. The major thing the UDP is concerned about is sending information. What then happens when you type google.com?

So the first this happens is that your browser looks into its cache to see if the website has been visited before and if its IP address is known. If not, the browser then asks the computer’s OS (operating system) to locate the website. The first place the OS is going to check is the hosts file (/etc/hosts in Linux and Mac or c:\windows\system32\drivers\etc\hosts in Windows). If the URL is not found, the OS, then makes a DNS request to find the IP address of the web page. The first step is to ask the Resolver, which is the ISP (internet service provider) to look up in its cache to see if the page has been visited before. If not, it then asks to root server to ask the TLD (top-level Domain) server e.g. (.net, .com) which then checks its cache to see if the IP is there. If not it then it will have at least one of the authoritative name servers associated with that URL and once it locates that server it would return the IP associated with that URL. After the OS receives the IP and gives it to the browser, it then makes a GET Request (HTTP method) for the IP address. When the request is made, the browser makes a request to the OS, which then packs the request to the TCP traffic protocol and is then sent to the IP address. On its way the request is checked by the OS and the firewall of the server to make sure there are no security violations, upon receiving the request the server (which is usually a load balancer directs traffic to the server which is available for that website) after this is done the chosen server then sends a response with its IP address and SSL (secure socket Layer) certificate to start a secure session using HTTPS protocol. Finally, the requested page containing HTML, CSS and JavaScript is sent to the OS, which sends it to the browser to interpret. This interpretation typically appears on your screen.

Resources:

What Happens When You Type google.com Or Any Other URL In Your Browser and Press Enter - Juan Felipe Buitrago Vargas

TCP vs. UDP — What's the Difference and Which Protocol is Faster? - Kris Koishigawa Learn everything about DNS in cartoon - howdns.works