What happens after typing a URL into a browser

Explain what happens, step by step, after you type a URL into a browser. Use as much detail as possible.

My initial thoughts:
Take the URL of my website as example: tianrunhe.wordpress.com.

  1. The browser searches for its cookie to see if the URL was stored. If yes, get its server address.
  2. If the URL is not stored, the browser sends a request to the domain server. The domain server returns a server address of my blog. This is domain resolution.
  3. The browser then sends a request to the server of my blog, the server returns a redirected address.
  4. The browser then sends another request following the redirected address, the server will returns a package of data, probably using POST method.
  5. The browser then render the data to show the webpage of the URL.

Solution:
There’s no right, or even complete, answer for this question This question allows you to go into arbitrary amounts of detail depending on what you’re comfortable with. Here’s a start though:

  1. Browser contacts the DNS server to find the IP address of URL.
  2. DNS returns back the IP address of the site.
  3. Browser opens TCP connection to the web server at port 80.
  4. Browser fetches the html code of the page requested.
  5. Browser renders the HTML in the display window.
  6. Browser terminates the connection when window is closed.

One of the most interesting steps is Step 1 and 2 – “Domain Name Resolution”. The web addresses we type are nothing but an alias to an IP address in human readable form. Mapping of domain names and their associated Internet Protocol (IP) addresses is managed by the Domain Name System (DNS), which is a distributed but hierarchical entity.
Each domain name server is divided into zones. A single server may only be responsible for knowing the host names and IP addresses for a small subset of a zone, but DNS servers can work together to map all domain names to their IP addresses. That means if one domain name server is unable to find the IP addresses of a requested domain then it requests the information from other domain name servers.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: