HTML, XHTML, and CSS, Sixth Edition

A browser application is only capable of showing text and a few kind of images. But there are a lot of different kinds of files out on the Web, including video, audio, PDFs, Flash animations, Scorch sheet music, and even PowerPoint presentations and Excel spreadsheets. In order to play or display these other kinds of files, a browser needs the aid of applications called players. There are both external stand-alone players that function as separate programs on your visitor's computer as well as plugin players that work right inside the Web page in the browser window.

You determine the kind of player that will be used when you write the (X)HTML code. When you link to a multimedia file, as described on page 285, that file is opened in an external player. When you embed a multimedia file, as described on pages 286309, the file is opened in the plugin within the browser window itself.

The most common plugins are the Flash and Shockwave players from Macromedia (part of Adobe), the QuickTime Player from Apple, the Windows Media Player from Microsoft, and Acrobat from Adobe. However, even these popular players are not installed on every computerthough Flash comes pretty close according to Macromedia. In addition, they are updated so often that visitors may not always have the particular version that your files require.

Object vs. Embed

There are two principal elements used to embed multimedia on a Web page: object and embed. The embed element started out as a Netscape extension and is not and has never been part of the (X)HTML specifications. Any page that contains it is not considered valid. Despite that fact, it continues to be universally supported.

In the other corner, we have the W3C's object element, an official component of both HTML 4.01 and XHTML 1.0. Unfortunately, Internet Explorer implements the object element in a way that makes other browsers ignore itin order to use its proprietary ActiveX controls. And if that weren't enough, IE doesn't completely support the object element itself, failing as the (X)HTML specifications requireto look for nested objects that it can support when the outer object proves too difficult.

The solution historically has been to offer IE an object element in the non-standard way that it requires for its ActiveX controls while at the same time nesting a nonstandard embed element within the object element that the rest of the browser population can handle. Frankly, I think we can do better. In this chapter, I'll show you how to embed without embed.

Категории