Design & Development

Have You Ever Wondered How a Website Works?

In the most basic terms, a website is a collection of files on the hard drive of a server that can be accessed by the public. Since this is not a very satisfying explanation of what a website is or how one works, perhaps it is easier to follow the pathway between someone that is surfing the Internet and the website they are viewing.

Type in a domain name

When you fire up your favorite web browser and type in the domain name of a website you want to view, the first thing that happens is that a request is sent to the server that is hosting that website. This server is found via the Domain Name Server (DNS) system, which associates the domain name (which we humans understand) and the address of the server that is hosting that website (which the computers understand). Once that request is received by the server, it looks at the files of the website to determine what happens next.

The first file to be checked is the home page file, which is usually called “index.html” by default, although another file could be assigned as the home page. If this file is a dynamic script, such as a PHP file, then the server runs the script and the appropriate HTML output is sent back to the browser that made the request. In the case of an HTML file, which does not require the server to do any processing, the file is sent or “served” directly back to the browser. This is referred to as a “response” from the server, and completes the basic cycle that makes websites work: the browser makes a request, the server processes that request, and returns and appropriate response to the browser.

Interpret the code

When the browser receives the response from the server, which is made up of primarily HTML code, it then proceeds to “parse” or interpret the code. Most websites require much more than simply HTML code to display properly. They also require images, Cascading Style Sheets, JavaScript and other assets to display properly. As the browser begins to interpret the HTML code, it will come upon references to these assets, telling the browser that it needs to get these files as well. It is not uncommon for a even a simple web page to require more then fifteen separate files in order to display properly, so the browser sends a request to the server for each file that it needs.

Display the website

When all the files that are required to display a web page have been downloaded, the browser is then able to properly display the website and the loading process is complete. We all probably remember waiting for images to download, or watching, as a web page slowly seemed to piece itself together in front of our eyes. Usually associated with a very slow Internet connection, the phenomenon is caused by the amount of time it takes for all of the files needed to display a web page are downloaded.

The process then starts all over again when a link is clicked, which triggers the browser to make a request for another file from the server.

Brian Getting

Brian Getting

Bio   •   RSS Feed


Sign up for our email newsletter