What Happens When Navigating to A Website

Have you ever wondered that what happens after you type “google.com” in the address bar of a browser, or why web pages can display right in front of you, rather than you running a marathon to grab it? Thanks to the Internet that makes the whole things happen. A website is like your house, and the internet is like a street. In order to connect to the internet, the website needs web hosting, which is like the land where the house stands on, as well as a domain name, which is something like the address of your home.

So what is Internet and domain name? The Internet is nothing but a global network of computers connected and talked to each other. In order to do that, each computer has to have a unique address, just like your ID, which is responsible for identifying you. The unique address is called IP Address, short for Internet Protocol address. So far, it explains how computers connect to each other and next question is how to talk. When your IP address 228.123.1.111, for example, wants to send to another computer a message “Hello world!”, the message will need to be translated to some electronic signals. That is where protocol stack comes to place. The protocol of talking between computers is TCP/IP.

Before TCP/IP Protocol stack, let’s take a look at Open Systems Interconnection model (OSI model) which has seven layers and network is inhabiting at, also it is built into computer’s operating system. Each layer is responsible for preparing certain things and pass it to next layer. The seven layers can be separated into two sets: application set, including application layer, presentation layer, and session; transport set: transport, network, data link and physical layer.

OSI model

TCP/IP protocol stack is referred to it. Specifically, illustrated as below:

TCP/IP protocol stack

Here is what happened when you send a message from your computer to the internet.

Internet workflow

After you type the URL “http://www.facebook.com/ming/photos/profolio.jpg" into a browser, here is what happened with the order:

1. The browser will connect to a domain name server (DNS) and translate the URL into an IP address, which is used to identify the server machine, and the DNS will look for the address in the cache. There are a few places that may have cached the IP address: browser, local OS, and router. DNS will look up the Host file. It is a physical file on your computer and usually stored in C:\Windows\System32\Drivers\etc\hosts (for Windows 7 and above, you need to use Notepad with admin authorization to open it), as well as look up for the local cache and to see if the browser or OS has the copy of the IP address. If it does not, the URL will be sent to DNS Server, which will be translated to IP address.

2. If the IP address is found in any of these caches, it will be returned to the browser. Now the browser knows what IP address was asking for and will translate it back into a URL. Meanwhile, the browser will render the page that interprets the response in a readable way.

3. If the IP address isn’t found, the browser will reach out the web server through DNS lookup and send HTTP request via protocol stack, which will be IP and port 80, asking for the specific file. The web server receives the request, after processing it, sends the response back, which is the HTML text to the browser. The browser will render and parse of the page that translated the response data steam to the language that human being can understand.

In order to understand the process, you need to get the idea of those highlighted terminologies.

  • URL

Uniform Resource Locator, a standard naming convention that locates and access to documents over the internet.

Let’s take the whole URL apart and analyze it. “http” is protocol, “www.facebook.com" is the domain name, and “profolio.jpg” is the file name. If the URL ends up with “/”, e.g. “http://www.facebook.com/", it means a folder rather than a file.

  • IP address

IP address is short for Internet Protocol address, which is to identify each physical machine within the internet, looking like 12.106.179.162. Machines on the internet would be servers or computers. Each machine has a unique IP address. If the computer connects to the internet through Internet Service Provider (ISP), the IP address is temporary which is used during the dial-in session; if connects through Local Area Network (LAN), the computer may have a permanent IP address. For example, servers’ IP address usually doesn’t change often, whereas home machines’ IP address will change after the session expires.

  • DNS

DNS stands for domain name servers. Basically, it is mapping between IP address and domain name. It translates them back and forth. Because IP address is not easy for human being to remember, it is necessary to translate it into things like “facebook.com”. Even though, it is still based on IP address for machines to connect to the internet and communicate with each other.

  • Cache

Cache is a place where store things temporarily in machines. The advantage of using cache is to improve the performance. There are some common places to use cache: cache in the server, cache in the hard drive of a local machine, and cache in memory.

  • Protocol Stack

As we illustrated above.

  • Port

In order to provide the access and availability, sever machines need port numbers. For example, one of the most well-known port is 80 for the web server.

  • packet

When a message passes through layers, it may break up into smaller chunks of data in order to send it over to the internet. The chunks of data are packets.

Like what you read? Give Minghua Zhong a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.