How Modern Browsers Work with HTML

Browsers interact with servers on the Internet using TCP/IP and HyperText Transfer Protocol (HTTP). [10] A browser issues a GET request with a page's URI, and an HTTP server responds with a "message" that contains HTML. This message is "a byte stream of ASCII characters ." Browsers download this stream of text as fast as possible. They don't download HTML files line by line; these are for human consumption and editing convenience.

[10] Roy T. Fielding et al., "Hypertext Transfer ProtocolHTTP/1.1," RFC 2616 [online], (Reston, VA: The Internet Society, 1999), available from the Internet at http://www.ietf.org/rfc/rfc2616.txt.

Lines are "delimited by an optional carriage return followed by a mandatory line feed character. The client should not assume that the carriage return will be present. Lines may be of any length. " [11]

[11] Tim Berners-Lee, "The Original HTTP as defined in 1991" [online], (Cambridge, MA: World Wide Web Consortium, 1991), available from the Internet at http://www.w3.org/Protocols/HTTP/AsImplemented.html.

The browser parses the document according to the specified or implied Document Type Definition (DTD). The parser makes a single pass through the document, starting at the head and working down to the end until all objects and HTML have been rendered. The parser inserts tags where they are implied and ignores or collapses to a single space any excess whitespace characters that appear before, after, and between tags. It does not display comments. Content between tags is displayed according to the associated DTD. Faulty HTML may require extra overhead, slowing display speed especially on slower systems like PDAs.

As the document downloads, browsers send out additional HTTP requests , one per object. An object can be any external file like CSS, JavaScript, images, and multimedia. Each HTTP request adds additional time, which can vary considerably, to the total page-display speed due to latency. Modern browsers send out multiple simultaneous HTTP requests (from 2 to 8) to speed downloads, especially on faster connections. That's why CNET's search.com had only four graphics on their home page in 1998, three of which were ads. [12]

[12] Matt Rosoff, "More Great Tips from CNET Designers" [online], (San Francisco, CA: CNET Networks, 1998), available from the Internet at http://www.builder.com/Graphics/CTips2/.

Line Length

HTML and XHTML have no official maximum line length; however, some HTML email programs (for example, Microsoft Outlook in Windows NT) give an overflow warning for viruses if your lines are longer than 255 characters. Most text editors have a practical limit due to buffer sizes. If you use vi to edit your files in Unix, you will find that it has an 80-character limit. If you are not emailing your HTML and you want to fully optimize a high-traffic page, feel free to remove most returns.

Older versions of the Oracle Information Server will break all lines longer than 2,048 characters on the fly. If you plan on emailing your HTML pages or want to play it safe, it's best to stick with no more than 255-character lines of HTML markup. If you don't stay within that guideline, make sure that your lines are less than 2,000 characters long.

Because HTML documents typically have shorter lines, removing unnecessary line breaks can save you up to 12 percent off file sizes. Here's an example:

 <table>  <tr> <td>speed</td> </tr> <tr> <td>me</td> </tr> <tr> <td>up</td> </tr> </table> 

Becomes:

 <table><tr><td>speed</td></tr><tr><td>me</td></tr><tr><td>up</td></tr></table> 

This is a savings of 10 bytes, or 11 percent (10/90).

 



Speed Up Your Site[c] Web Site Optimization
Speed Up Your Site[c] Web Site Optimization
ISBN: 596515081
EAN: N/A
Year: 2005
Pages: 135

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net