How The Web Works
This tutorial is part of a web programming course for people who have no programming experience.
So far all, of the pages that we have created and used for this course live on your computer. But in order to publish a page to the web, so that anyone with a browser (and an internet connection) can view it, it must be copied to a web server. A web server is a computer on the internet that runs software that can send your web pages to browsers. Every web server on the internet has a name, which is known as a domain name (sometimes it's referred to as a server name or a host name).
Let's break down the process of how people actually browse the internet. The web uses a client/server model, where the client is a browser application, such as Chrome or Firefox, and the server is a web server. When you click on a hyperlink, your browser will create what's known as a request. A request is a simple text message that includes the URL of the page that the browser intends to display. A URL includes a domain name (which represents a specific web server), and often a path to a specific web page on the server.
The request gets sent to the web server that matches the domain name in the URL. The details how the request reaches the destination server is beyond the scope of this lesson. But I'll just mention that it's the magic of the domain name system, which you'll learn more about in your Cisco class.
When the web server receives the request, it looks at the URL in the request and then retrieves the specific web page in the URL. To do this, it looks at the path in the URL. All files for a website are contained within the document root directory of the web server. So the path in the URL will be relative to the web server's document root directory. In the case of our example URL, the web server (named www.somedomain.com) will look inside it's document root directory for a folder named somefolder. And within that folder, it will look for a web page named somefile.html. Once it finds that file, the web server will send it to the browser. This is known a response.
Sometimes a URL will not include a path (it will just include the protocol and the domain). In this case the browser is requesting the home page for the site, which is usually a file named index.html that is located in the document root directory of the web server.
Similarly, sometimes the path portion of a URL only includes folder names, and no specific file. In this case the web server will follow the path by digging into the folders, and then look for a file named index.html within the specified folder.
The browser will receive the web page (in the case of our example URL, the web page is named somefile.html), and will analyze the HTML code from top to bottom. The browser may have to make additional requests in order completely load the page. For example, as the browser analyzes the HTML code, it may come across an IMG element, and then it will have to to make a request to download the image so that it can display it. The same holds true for other files that the web page may link to. For example, if the browser finds a link to a style sheet, it will have to make a request for the stylesheet. The server should respond by sending the .css file to the browser. The browser will than analyze the CSS code in the style sheet and apply it the HTML elements accordingly.
So, when your browser requests a page from a web server, it often leads to additional requests, because all the files used by a web page must be sent to the browser. The transfer of all these files from server to client is largely invisible to the person using the browser. And it's amazing to think about how much information is transfered, usually in the span of just a few seconds.NEXT LESSON: Going Live With Your Website