Sunday, October 6, 2013

How a browser gets a webpage

Almost all decent browsers have an address bar so users can easily type a web address in and navigate to that webpage.

But how does the browser know which page to get and where to get it from?
When an address (URL) is typed in and Enter is pressed  the browser sends out a request  looking something like "https://www.google.com.au/".
Breaking this down gives an overview of what does what.

"https://" Called a scheme, gives information on how to connect eg. ftp,http or https.
"www.google.com.au" This is called the host, it can either be an IP address (72.14.207.99) or can go through a DNS server that resolves "www.google.com.au" as having the IP 72.14.207.99
It gives information on where to connect.

The host can also have a port specified by having a ":" after the IP/Domain name.  Web server ports are usually configured for port 80 as a standard.

After the host/port ther is one last thing, the path of the resource eg. "http://en.wikipedia.org/wiki/Domain_name" where "/wiki/Domain_name" is the path to the selected resource.

So for a browser to get a webpage it sends out a request to the DNS server for a particular URL, the DNS will then resolve the IP of the web server and communicate this back to the browser.  The browser then sends a request to a server running on that IP then the server responds with the requested information from the requested directory on the server.
The browser then interprets these packets of information and displays a webpage on the screen

No comments:

Post a Comment