How Browser Interprets When We Hit Some Url

Posted By : Palak Sharma | 30-Apr-2018

Being a developer we serve many URL's in our browser but never given a thought what happens behind the picture. This blog will explain in detail what happens when we hit a particular URL in a particular browser.

 

Below are the points explained in detailed:- 

1) We type a URL say "www.google.com" in our browser.

 

2)When we say we want to reach to some particular URL we actually want to reach out to a server where that particular URL is hosted. Well, that server must have an IP address so if we enter some URL like http://192:22:88:8080/ or a domain name in which it is hosted it is one and the same thing.

 

3) Our browser has a cache which maintains the DNS ( Domain Name System) Records if suppose our URL will be saved in the cache it will automatically serve the HTML Files documented in our module or project. 

 

4) But if it will not be stored in the cache, then it will first initiate the TCP request to the server. The browser will send a get request to the server according to the specification of Hyper Text Transfer Protocol.

GET http://google.com/ HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:29.0) Gecko/20100101 Firefox/29.0
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: google.com
Cookie: datr=1265876274-[...]; locale=en_US; lsd=WW[...]; c_user=2101[...]

Here server will pass some meta information in headers and User Agent will initiate the TCP call to get the response from the server end. The request also contains cookies  which are stored at client end and contains previous browser session information.

 

5) HTTP request are handled by common servers for eg APACHE etc. As soon as the request is received our server prepares the environment to execute it .

HTTP/1.1 200 OK
Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Pragma: no-cache
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
Connection: Keep-Alive
Content-length: 1215
Date: Fri, 30 May 2014 08:10:15 GMT

Broswer receives the HTTP response and then broswer displays the Html content to the user with indexing.

 

6) Now once our page is loaded there are several ways for users to interact with server , eg , like AJAX.

 

Hence , all these steps are the major aspects which a broswer covers when there is a particular hit.

About Author

Author Image
Palak Sharma

Palak is enthusiastic and passionate about coding , Her areas of expertise in coding languages are JavaScript and angular , html and css .

Request for Proposal

Name is required

Comment is required

Sending message..