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

Ever wondered what happens immediately you type "https://www.google.com" in your web browser and press the enter key or click the search button? Well I would be telling you in summary what goes on and the different processes involved in giving you the desired search result.

Understanding what a web browser is would be a good place to start, wont it? Now a browser is basically an app that you use to access the web, that simple. Common examples include: Chrome, Firefox, Safari, Edge, etc.

When you type a URL like "https://www.google.com" into a web browser and hit the enter key, numerous things happen before you finally get some output on your browser (your desired result). These activities happen very quickly in split seconds, I would give you a brief overview before I dive into explaining the in detail.

A brief explanation of what happens when you type a URL into a web browser.

  1. A request is sent from your computer to the domain name system (DNS) server which serves as an address book for all domain names. This then sends back the exact IP address of the server which https://www.google.com points to.
  2. Through this IP, a connection is then established with the server through the IP address. This type of connection is termed as Transmission Control Protocol (TCP) and this is made possible through the Internet Protocol (IP)
  3. If your computer exists behind a firewall, that firewall checks to ensure that the request being made is authorized before permission is granted. A similar check will be carried out on the server your computer is trying to access if it is behind a firewall.
  4. Once the connection is successfully established, your browser then sends a request for the webpage using Secure Sockets Layer (SSL) or Transport Layer Security (TLS) in order to encrypt the data that would be shared between your computer and the server. SSL and TLS are popular encryption protocols that basically make sure that the information exchanged between a computer and a server remains secure.
  5. Companies like Google with high traffic maintain a host of servers and to handle this efficiently they employ the use of a load balancer that receives most of the requests and sends it to a designated server. The request from your browser will therefore hit the load balancer first which will forward it to a specific server depending on the algorithm used by the load balancer.
  6. The server that gets the request sent out then sends a response back to the load balancer which in turn forwards the message to your browser.
  7. The response would contain HTML, CSS and JavaScript files that make up Google's homepage. The HTML file has a responsibility of telling the web browser how to render the content of the webpage, the CSS file tells the browser how the content should be styled while the JavaScript file handles the interactivity of the page.
  8. If a need arises for some dynamic content such as Google search results, the web server will then make a request to the application server, which in turn may make a request to a database server to get some data and send it back to the web server. The web server will then include these in the response that it sends back to the browser.
  9. Finally the web browser render the page and displays it for you to see.

A lot right? Yeah I thought so too. Now let us go into some more detail.


DNS Request

This is the first and most important thing that happens when you search for a website, without a DNS request there wont be any response hence no result, or desired webpage would be rendered.

Whenever you use a web browser to access any website or domain name, that browser stores information concerning that domain name in a storage location called the cache.

In essence when you type a domain name into your web browser, a check is done in the cache to ascertain if a recent copy of the DNS records exists for that domain.

Should there be a recent copy of the DNS records for that domain; the IP address in the cache would be used to send a request to the server. This speeds up the process of resolving the domain name as the need to send a request to the DNS server becomes unnecessary.

However, if the browser cache does not contain a recent copy of the DNS record the browser goes on to send a request to the DNS server to resolve the domain name to an IP address.

The DNS look up process is discussed below:

  1. Web browser sends a request to the local DNS resolver provided by the internet service provider (ISP)
  2. The local resolver makes a cache check to see if a recent copy of the DNS record exists for the domain or not. If it exists the IP address is sent back to the browser, else if it doesn't exist a request is sent to a root nameserver.
  3. The root nameserver responds with the address of a top-level domain (TLD) nameserver, such as .com or .org.
  4. The local DNS resolver sends a request to the TLD nameserver.
  5. The TLD nameserver responds with the address of the authoritative nameserver for the domain.
  6. The local DNS resolver sends a request to the authoritative nameserver.
  7. The authoritative nameserver responds with the IP address for the domain.
  8. The local DNS resolver sends the IP address back to the browser.
  9. The browser seinds a request to the server at the IP address to retrieve the webpage.

Additional steps might be involved if the DNS record isn't found at any of the nameservers or if the record has been configured to make use of DNS load balancing services of content delivery networks (CDN).


TCP/IP Connection

TCP (Transmission Control Protocol) and IP (Internet Protocol) are two of the main protocols that makeup the internet. These protocols work together to continually establish connection between a client and a server in order to facilitate effective data transmission between them.

  • The browser sends a request to the server to ensue a connection
  • On recieving the request the server returns a message acknowledging the reciept of the request to establish a connection. This is known as the the handshake process.
  • The browser can then send a request for the webpage it wants to access through the application of TCP which makes sure the request is trasnmitted reliiably and precisely.
  • The server having recieved the request sends back the codebase for the webpage; in this case google.com. The TCP is also applied here to ensure reliable transmission.
  • The web browser then renders the webpage based on the codebase it recieves.


Firewall

A firewall is a security system that monitors and controls incoming and outgoing network traffic based on predetermined security rules. Its primary purpose is to protect a network from external threats, such as hackers and malware.

When a user types in a URL into a browser, the request made to the server passes through the firewall on its way. The firewall is responsible for checking the incoming request to make sure it is allowed and authorized based on its security rules.

There are two categories of secutiry rules that firewalls follow to check incoming requests:

  • Rules that allow or block traffic based on the source and destination of the request. 
  • Rules that allow or block traffic based on the type of traffic.

So if the incoming request meets all security rules made present by the firewall it is allowed through and access to the website is granted.

In the situation where the request doesn't meet the security rules, access to the website isn't granted.


HTTPS/SSL

HTTPS (Hypertext Transfer Protocol Secure) is a secure version of the HTTP protocol used to transmit data over the internet. It is used to encrypt the data transmitted between your browser and Google's server.

SSL (Secure Sockets Layer) and TLS (Transport Layer Security) are encryption protocols that are used to secure the data transmitted over HTTPS.

When your browser establishes a connection with Google's server using HTTPS, your browser and Google's server first agree on the version of SSL/TLS to use and then create a secure, encrypted channel for transmitting the data.


Load-balancer

A load balancer is a device that distributes incoming network traffic across a group of servers or resources.

It has a primary function of ensuring that traffic is distributed evenly across the servers in order to avoid overloading any of the servers and aims to increase the total capacity and reliability of the system.

So, when a browser tries to access google.com, the load balancer receives the incoming request first and then forwards it to one of the servers available in the Google server network. The load balancing algorithm determines which of the servers would be chosen.


Web server

A web server is software or hardware that uses HTTP (Hypertext Transfer Protocol) and other protocols to respond to client (a web browser trying to access a website like google.com) requests made over the World Wide Web. The main job of a web server is to display website content through storing, processing and delivering webpages to users.

After receiving a request the web server processes the request and generates a response which would include the codebase that makes up the webpage.

The codebase would include HTML, CSS and JavaScript files that would be responsible for how the web page would be rendered.


Rendering the webpage

When response is received by the browser from the web server, it processes the HTML, CSS and JavaScript files that make up the response in order to successfully render the webpage.

This process involves interpreting the the markup and CSS code, rendering any images that might be included and executing any JavaScript logic that is present of the webpage.

Once the page has been fully rendered, you can now interact with it by clicking links, entering text, or interacting with other elements on the page.


Conclusion

This post is my submission to a task focused on technical writing as part of the ALX Africa Software Engineering program.

I hope you understand now what happens when you search out a URL on your web browser.

Thank you.





To view or add a comment, sign in

Others also viewed

Explore topics