DEV Community

Cover image for What happens when you type in a web address in a browser and press enter. (example: www.google.com)
James Ononiwu
James Ononiwu

Posted on

What happens when you type in a web address in a browser and press enter. (example: www.google.com)

The internet as we know it, has come a long way and is here to stay. the Internet was originally developed In the 1960s as a means for government researchers to exchange information. However, at that time, computers were bulky and stationary, and to access data stored on a particular computer, one had to either physically travel to its location or rely on magnetic tapes sent via traditional mail delivery systems.
Today one can access the internet from the comfort of their home, in fact every device nowadays is getting smart. from smart TVs to smart locks that gives you access to the doors of your home from anywhere around the world you might be.
But how does this work?.
In this article I will explain in simple terms what happens under the hood, the moment you typed in a web address and hit enter on your keyboard.
The fact is that web pages you see displayed on your browser when are just files called HTML (Hypertext Markup Language) stored in a computer sitting somewhere with access to the internet. this type of computer that stores and serves files is called a web server. HTML files are formatted in a certain way so that your browser understands it.
The web browser makes request to this servers asking for a file.
The web server after validating the request, performs some actions which might include retrieving data from a storage called a database and sends the required files back to the web browser. Some websites use an application server to handle more complex tasks, such as running business logic or processing payments.
The web browser parses the files and displays them on the screen.
But before the three steps are completed, a lot happened within some seconds taken to send out the GET request ( in this case www.google.com) from the browser and receiving a response data from the server. that process is what I'm about to explain.

DNS
A domain name system (DNS) is a record that holds the IP addresses of domain names, it translates human readable domain names to machine readable IP addresses. Your browser first needs to know the IP address of the domain name (ie. www.google.com) which it does by sending a request to the Domain Name System (DNS). The DNS server looks up the IP address associated with the domain name and returns it to your browser. The IP address is a unique set of numbers that identifies every device on the internet, it ranges from 0 to 255 and separated by periods (ie. 192.0. 2.44) . The browser sends the request to the IP address which is the identifier of a computer connected to the internet.
This is like looking up a phone number in a phonebook.

TCP/UDP
Once your browser has the IP address, it establishes a connection using the Transmission Control Protocol (TCP) or User Datagram Protocol (UDP).
TCP breaks the data into packets (smaller pieces) and sends them across the internet, this method ensures that all packets are delivered. for an instance when downloading a file from the internet and there's a network error, when the network reconnects, the download resumes from the exact spot. this is because the server knows the amount of packets sent and how many remaining. on the other hand UDP is mostly used for video streaming and playing online games, this is because it is faster, the speed is due to the fact that it cares less about delivering all packets, that is why if a live streaming freezes, you will be moved to the current stream when the network resumes, or see the screen skip to the current time in the case of video games. These protocols are used to connect and send data between a browser and a server while IP makes sure they are delivered to the right destination.

FIREWALL
As the packets travel through the internet, they may pass through several firewalls. These are security measures that monitor and filter incoming and outgoing traffic based on pre-defined rules set on the devices. Think of firewalls as a security personnel at a very important event who checks IDs and only allows access to people who meet certain criteria.

HTTPS/SSL
Most times when you send a request to a web server, you will see a key icon beside the domain name you entered, this means that the server is serving the file via HTTPS (Hyper Text Transfer Protocol Secure), which also means that the data is encrypted using SSL (Secure Sockets Layer) or its successor, TLS (Transport Layer Security). This ensures that any sensitive information, such as login credentials, is protected from people that might maliciously intercept it using a method called man-in-the-middle attack, and use it to perform actions that might be harmful to the owner, this set of people are called hackers. when you try to access a web page that does not have this security measures, your web browser usually gives a warning to inform you that the site you want to access might pose as a security risk.

LOAD BALANCER
If the website receives a lot of traffic, it may use a load-balancer. a load balancer is a server that distributes the incoming requests across other multiple web servers, so that no single server gets overloaded. using a single server might result in failures in delivering requests when there's too many visits in short amount of time (traffic). using a load balancer ensures that the requests is distributed among multiple servers, if one has an issue, there will be others to respond thereby delivering the expected result.
This is like a popular restaurant using multiple waiters to serve customers, so that no single waiter gets overwhelmed.

CONCLUSION
In conclusion, when you type www.google.com in your browser and hit Enter, a lot of complex processes happen behind the scenes to deliver the requested web page to your browser. Understanding these processes helps to appreciate the complexity of the internet and how it has revolutionized the way we communicate and access information.

Top comments (0)