Server to Web Browser

Most of us don’t even think about what is happening when we click a link or put a web address into our browsers. All we are thinking about is what we want or need to see. However, if you own a website, or plan to, it is important to have a basic understanding of what happens between the time a user clicks the link or types in the address and the time that your webpage is displayed in the browser. It may be fast, but there is quite a bit going on.

Hyper Text Transfer Protocol

When a user clicks a link or types an address into the address bar of their web browser, they are essentially requesting a document. The request must be ‘handled,’ meaning that it is ‘dealt with’ in some way. That way, in terms of browsers, is with HTTP, or Hyper Text Transfer Protocol. This is the http:// portion of the website address.

The browser looks at the HTTP address, and sends a request for the document that is supposed to be located at that address to the server where it resides. You could consider the server a ‘neighborhood’ and the document as a ‘house’ in that neighborhood. Think of the browser as the postman, delivering mail in that neighborhood, and then to that particular house.

The browser essentially serves as the go-between for the user and the server. It is used to display the document that has been requested through the HTTP. A server quietly waits for a request, constantly monitoring TCP port 80, as this is where the request will come into the server.

Transmission Control Protocol

TCP is Transmission Control Protocol, and this is used to connect one computer to another for the purpose of transmitting data. The computer that is requesting the document or data is identified with TCP technology, and time stamped. Again, Port 80 is used when a web document is requested, but there are other ports that are used and monitored as well. For example, TCP port 21 is the port that is used for FTP transfers, when users are uploading or downloading files. However, for HTTP requests, port 80 is always used.

You may type something simple like http://www.webpage.com or even www.webpage.com into your browsers address bar. But this is not exactly the request that is sent from the browser to the server. Instead, the request looks more like this (behind the scenes):

GET /index.html HTTP/1.1

Host: http://www.webpage.com

If an index.html page is available, the server responds with:

HTTP/1.1 200 OK

Date: Tue, 14 September 2010 23:48:32 GMT

Server: Apache/1.3.27 (UNIX) (Red-Hat/Linux)

Last-Modified: Mon, 13 Sept 2006 08:10:14 GMT

The server then allows the browser to access and display the webpage. Again, all of this happens in seconds, and the average user does not see all of this – and in most cases does not think about how the browser and server are communicating with each other.

Take a look at the HTTP/1.1 200 OK portion of the server’s response. This has an important meaning. The code 200 means that all is well, and that the webpage requested is available. However, there are other codes that the server may respond with as well, depending on whether or not the page is actually available, such as 404, which is an error code indicating that the page requested does not exist on that host.

Web Browser

Now, how does the webpage display? It is sent to the browser in a series of data packets. Each packet contains a header that tells the browser where that packet should be displayed on the page. The page is essentially broken up into various pieces for ‘shipping’ between the server and browser, and then quickly reassembled by the browser when it arrives. Each data packet may be sent through different routers to ensure faster delivery of all of the components of the page.

The browser is actually very polite, and essentially sends the server a ‘thank you’ note, letting it know that all packets have been received. If the server does not receive that acknowledgement, it will attempt to transmit the packets again. TCP treats everything as ‘fragile’ and makes sure that none of the packets are damaged during transmission as well.

The server is also very polite to the browser, in that it will allow the connection to the port to remain open for a certain period of time, essentially saying ‘can I be of further assistance?’ This ensures that if you request additional pages from that website, they will be served quickly – usually faster than the first one that you requested, because the connection is already open, and the server is standing ready, anticipating what you may need.