Полезная информация

HTML: The Definitive Guide

Previous Chapter 1
HTML and the World Wide Web
Next
 

1.5 Nonstandard Extensions

You don't have to write in HTML 3.2 for long before you realize its limitations. That's why Netscape Navigator quickly became the most popular browser less than a year after it was released. While others were content to implement HTML standards, the developers at Netscape were hard at work extending the language and their browser to capture the potentially lucrative and certainly exciting commercial markets on the Web.

With a market presence like that, Netscape leads not only the market, but the standards drive as well. Those browser features that Netscape provides and that aren't part of HTML 3.2 quickly become de facto standards because so many people use them. Consequently, Netscape is the browser other developers must emulate. For instance, Internet Explorer, developed in collaboration with Spyglass (the purveyor of NCSA technologies) and bundled with Windows 95, adopts most of Netscape's enhancements to HTML and has some embellishments of its own.

Extensions: Pro and Con

Every software vendor adheres to the technological standards; it's embarrassing to be incompatible and your competitors will take every opportunity to remind buyers of your product's failure to comply, no matter how arcane or useless that standard might be. At the same time, vendors seek to make their products different and better than the competition's offerings. Netscape's and Internet Explorer's extensions to standard HTML are perfect examples of these market pressures at work.

Many HTML document authors feel safe using these extended browsers' nonstandard extensions, because of their combined and commanding share of users. For better or worse, extensions to HTML made by the folks at Netscape or Microsoft instantly become part of the street version of HTML, much like English slang creeping into the vocabulary of most Frenchmen despite the best efforts of the Académie Française.

The reality, however, is that browsers are becoming less and less standard--de facto or not. The W3C isn't keeping up. And other browser developers are not about to remain quiescent for long. Increasingly, browser competitors are implementing the many extensions to HTML and adding a few of their own for good measure.

Avoiding Extensions

In general, we urge you to resist using an HTML extension unless you have a compelling and overriding reason to do so. By using them, particularly in key portions of your documents, you run the risk of losing a substantial portion of your potential readership. Sure, the Netscape community is large enough to make this point moot now, but even so, you are excluding several million people without Netscape from your pages.

Of course, there are varying degrees of dependency on HTML extensions. If you use some of the horizontal rule extensions, for example, most other browsers will ignore the extended attributes and render a conventional horizontal rule. On the other hand, reliance upon a number of font size changes and text alignment extensions to control your document appearance will make your document look terrible on many alternative browsers. It might not even display at all on browsers that don't support the extensions.

We admit that it is a bit disingenuous of us to decry the use of HTML extensions while presenting complete descriptions of their use. In keeping with the general philosophy of the Internet, we'll err on the side of handing out rope and guns to all interested parties while hoping you have enough smarts to keep from hanging yourself or shooting yourself in the foot.

Our advice still holds, though: only use an extension where it is necessary or very advantageous, and do so with the understanding that you are disenfranchising a portion of your audience. To that end, you might even consider providing separate, standards-based versions of your documents to accommodate users of other browsers.

Beyond Extensions: Exploiting Bugs

It is one thing to take advantage of an extension to HTML, and quite another to exploit known bugs in a particular version of a browser to achieve some unusual document effect.

A good example is the multiple-body bug in Version 1.1 of Netscape Navigator. The HTML standard insists that an HTML document have exactly one <body> tag, containing the body of the document. The now-obsolete browser allowed any number of <body> tags, processing and rendering each <body> in turn. By placing several <body> tags in an HTML document, an author could achieve crude animation effects when the document was first loaded into the browser. The most popular trick used several <body> tags, each with a slightly different background color. This trick results in a document fade-in effect.

The party ended when Version 1.2 of Netscape fixed the bug. Suddenly, thousands of documents lost their fancy fade-in effect. Although faced with some rather fierce complaints, to their credit, the people at Netscape stood by their decision to adhere to the standard, placing compliance higher on their list of priorities than nifty rendering hacks.

In that light, we can unequivocally offer this advice: never exploit a bug in a browser to achieve a particular effect in your documents.


Previous Home Next
HTML: What It Isn't Book Index Tools for the HTML Designer

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell