Home : Topics : Web servers : Requesting a simple Web page
Introduction
HTTP
Requesting a simple Web page
Web server complexities
Summary
< Previous: HTTP

Requesting a simple Web page

This page follows the sequence of events involved in requesting a simple Web page with one picture.

Example page

As an example, we take a page including a small amount of text and a single picture. The part of page with a picture might look like this:

<img src="pic.gif" alt="My picture">

We assume this page is available on the Web at http://www.mycomputer.com/test.html.

1. (Browser) Request page

The browser first connects to www.mycomputer.com and sends an HTTP request for the file /test.html.

2. (Server) Send page

The server receives a request for /test.html. It checks to see that the file exists. When it finds the file, it then sends an HTTP response containing the file contents back to the browser.

3. (Browser) Receive page

The browser receives the HTML response. It checks the type of response; because the response was a standard (non-error) response, no special action is taken. Because the file retrieved is an HTML file (of the text/html MIME type), the browser can display it, rather than saving it to disk or running some other program.

4. (Browser) Display page

The browser then processes and displays the HTML file. The file contained an image request, but it doesn't have the image yet, so it displays a placeholder and sends a request to the same server for the image file /pic.gif.

5. (Server) Send error

The server receives a request for /pic.gif. Just as last time, it checks that the file is present; unfortunately in this case it is not. So, rather than sending the file, it responds with an error code 404 ('File not found').

6. (Browser) Receive error

Finally, the browser receives a 404 response to its request for pic.gif. Because it now knows the picture is not valid, it redraws the page with a 'broken image' icon for the picture, containing the alternative text. (If the picture had been valid, it would have redrawn the page with the picture.)

The page load is now complete.