HTML and CSS Reference
In-Depth Information
combining <object> and <embed> Tags
You've seen how to code with both the <object> and <embed> tags to include plug-in content, but
the question remains, which do you use? For many web designers, the answer is both. To achieve
full cross-browser compatibility, the two tags can be combined to provide the user with the best pos-
sible user experience. Take a look at how it's done.
You'll recall that the <object> tag allows alternative content to be included between its opening and
closing tags. To combine the two tags, you simply add a parallel <embed> tag — one that has all the
same attributes — within the <object> tag. Here's an example that inserts a QuickTime movie into
the page:
<object classid=”clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B” width=”432”
height=”376” codebase=””>
<param name=”src” value=”assets/”>
<param name=”autoplay” value=”true”>
<param name=”controller” value=”true”>
<embed src=”assets/” width=”432” height=”376” autoplay=”true”
Although most of the attributes — such as src , autoplay , and controller — have direct matches
in both tags, a couple are distinct. The classid and codebase attributes are found only in the
<object> tag, and the pluginspage parameter is used only in the <embed> tag. Be sure to check
with the plug-in provider's documentation to see what specific attributes are required and which
others are optional, but available.
Although the code can be a bit of a hassle to work with, the good news is that the effort really
pays off. From a user's perspective, the plug-in content works almost exactly the same, as shown in
Figure 23-3.
FiGure 23-3
Search WWH ::

Custom Search