HTML and CSS Reference
a key/value pair to the plug-in in question. Earlier, in the embed element section, there
was an example of using embed with a custom loop attribute to tell Flash Player to
loop its playback. This example could be rewritten using the object and param ele-
ments like so:
<param name="loop" value="true" />
In this example, there are no custom attributes (unlike the analogous embed ex-
ample); instead, the custom settings are communicated through the name / value attrib-
utes on param .
It's unlikely that you'll ever be hand-coding the parameters for embedded plug-ins
(Adobe Flash, for instance, will generate the required param elements when you pub-
lish content out of the authoring environment), so I don't cover this sort of usage in great
detail here. Simply be aware that when embedding plug-in-based media, the object
element is what you usually need to use.
4 The object element was commonly used to embed YouTube videos, for instance (YouTube has
since moved to using iframe for embedding video on other sites).
To wrap up this discussion on embedded media, it's important to mention a feature
of the object element that came up earlier: the fallback content mechanism. How ex-
actly is this done? Well, it's quite intuitive and easy to implement. You can nest object
elements (or other elements), allowing the web browser to display alternative content if
it cannot render the preferred choice. For instance, you can nest a video, an image, and
finally some text like so:
<object data="video.mpg" type="application/mpeg">
<object data="picture.jpg" type="image/jpg">
href="video.mpg">a download link</a>.
The user agent should first try to display the video, but if it can't, it should then try to
display the image, and if it can't do that, it displays the text—no need for alt attributes