Buy One, Get a Bunch for Free
Have you ever tried to load a web page and noticed that some parts show up right away while the rest of the page fills in slowly? In this section, you'll learn what causes that.
In reality, when you load a web page from your browser, you actually get a lot of files, not just one. When the browser gets the first file, as in Figure 8-14, it really has just begun to load what the average user thinks of as the web page. Often, the first object downloaded by HTTP is an HTML file. (The term "object" refers to individual files that HTTP transfers; each web page consists of one or more objects.)
HTML files include text that goes on the web page, formatting instructions, plus instructions for the browser to download other objects that should also be displayed. For instance, when Conner loaded Fredsco's home page, he got a file called home.html. This file included a lot of the text that goes on the home page and some instructions about where to put various graphical images. However, the HTML file did not include the graphics images; they are in separate files on the web server and are considered to be different objects. So, the real process happens something like this:
|
1. |
Conner's browser gets the HTML file using HTTP.
|
|
2. |
Conner's browser reads the file, displaying things on the screen as a result.
|
|
3. |
When Conner's browser reads the file, it might have instructions that require Conner to download other objects. If so, it uses HTTP to get those objects.
|
|
4. |
Conner's browser reads the contents of the new objects, displaying things on the screen as a result.
|
|
5. |
When Conner's browser reads the newly downloaded objects, the objects might have instructions that require Conner to download other objects. And so on….
|
Eventually, the process ends, all objects are downloaded, and the browser displays something that looks like the web developer intended. Figure 8-15 outlines a simple example.