From Browser to Bytes: What happens when you type google.com in your browser and press Enter
Have you ever asked yourself “How the Internet works?” or more especially “What is happening behind the scences when I search for a website?” ? If you did, then you came to the correct article. Note that we’ll assume that we’re working on a new machine that we’ve not searched for any websites on its browser yet.
We’ll be talking about 8 phases: Initial writing, URL parsing, Finding protocol, DNS lookup, SSL, HTTP GET requests and HTML parsing.
Initial writing
When you write URL “google.com”, when you write the first letter ‘g’, the browser starts comparing and searching for the websites that you’ve visited before that its domain starts with ‘g’, in our case there’s no websites in the history because it’s a new machine and we’ve assumed that we’ve never searched for anything yet.
URL parsing
When you finishes writing “google.com”, the browser begins to decide whether the string that you wrote is a URL to visit or sth you want to search for and get search results ? in our case it’s URL to visit.
Finding the protocol
Because when you write “google.com” for example, you did not specifiy what protocol to use, so it’s the browser’s role to do that. It needs to decide which protocol to use, HTTP port 80 or HTTPS port 443. Well, default protocol is HTTP, but luckily a browser have sth like a list that stores the domain names of websites that uses HTTPS, so it can decide that the correct protocol for “google.com” is https.
DNS Lookup
When you type “google.com” in your browser, it wants to find where Google’s website is on the internet. Before any DNS requests, the browser checks its cache (a data storage for websites) for Google’s IP address, but since it’s our first time, there’s no data there. It also checks the operating system (OS) hosts file, but let’s assume it’s not there either.
Now, the DNS requests come into play:
Your Request: The browser asks a DNS (Domain Name System) server, “Where is ‘google.com’?”
Root Server and .com Server: The DNS server checks with a root server to know who handles “.com” domains. Then, it asks the “.com” server about “google.com.”
Google’s Address: The “.com” server directs to Google’s DNS server, which knows the specific IP address of “google.com.”
Getting the IP: The DNS server provides your browser with the IP address, like a unique phone number, for “google.com.”
Now, with this IP address, your browser can finally locate Google’s website on the internet. This process is like asking for directions to a place you’ve never been before.
SSL Handshake:
After obtaining the IP address, your browser initiates a secure connection with the server using SSL.
Handshake Initiation: Browser and server exchange messages to establish a secure connection.
Public Key Exchange: Server provides a public key for encryption.
Session Key Creation: Browser and server create a session key for secure communication.
Secure Connection Established: A secure channel is now in place for private data exchange.
HTTP GET Request:
With a secure connection, your browser sends an HTTP GET request to the server, asking for the web page content.
Requesting the Web Page: Browser sends an HTTP GET request to the server, saying, “Send me the content of ‘google.com’.”
Server Response: The server replies with the HTML document containing the webpage’s structure and content.
Application Server, Firewall, and Database Integration: Behind the scenes, the application server, firewall, and database play crucial roles in handling your request:
The application server processes your request, executing necessary operations to generate the webpage dynamically.
The firewall ensures that the communication between your browser and the server remains secure and free from unauthorized access.
The database stores and retrieves data, providing the content for the webpage your browser requested.
HTML Parsing:
After receiving the HTML document, your browser interprets and processes it to display the webpage.
Parsing HTML: Browser understands the structure of the page from the HTML code.
Executing Files: If the HTML includes additional resources (CSS, JavaScript, images), the browser requests and executes them to render the complete webpage.
To sum up, when you type “google.com,” a lot happens behind the scenes. From finding the website’s address to making sure it’s secure and getting the page content, it’s a complex process. Understanding this helps us see the interesting way browsers and the internet work together. So, the next time you search for something, remember the hidden steps that make it all happen smoothly.
References:
What happens when you type google.com into your browser and press enter? (Detailed Analysis) — Hussein Nasser

