Home > Articles > Open Source > Ajax & JavaScript

  • Print
  • + Share This
This chapter is from the book

This chapter is from the book

But Your Honor, I Object!

Okay, the entire last section was filled with lies. Not that I'm trying to steer you wrong—I'm trying to do quite the opposite. All external media should be addressed using the object element if you want to be using markup that exists in the valid world of HTML and XHTML.

However, there's a big stumbling block with using the object element, and that is that support for it is inconsistent across browsers and platforms. This is very disturbing from a purist's point of view because there's no other alternative within the specifications.

Here's what it boils down to, in simple terms: If you want your multimedia to be as consistent as possible across browsers, you have to turn to a proprietary element, the embed element. This element has never existed in any of the formal specs, but most all browsers support it; although your pages with the embed element will cause validation errors, they're going to work.

Conventional wisdom mixes both object and embed. So if you were to use this approach with the same Flash file just described, you'd end up with the markup shown in Example 3-8.

Example 3-8. Embedding a Flash movie file (SWF) into a page using <object> and <embed>

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100"
height="100" codebase="http://active.macromedia.com/flash6/cabs/
<param name="movie" value="media/ava.swf" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="quality" value="high" />
<embed src="media/ava.swf" width="100" height="100" play="true"

   loop="true" quality="high"></embed>

The Flash movie will now play inline in almost every browser.

  • + Share This
  • 🔖 Save To Your Account