Main Page

Including parameters

If there is no registered plugin for the MIME type, the browser may (depending on which one you are
using) offer to install the correct plugin for the file. Many browsers also look for the
pluginspage
attribute, which is an unofficial attribute of
<object/>
(it doesn’t exist in the HTML specification).
This attribute specifies where to find the plugin for the embedded object if it isn’t already on the user ’s
machine. Example:
<object type=”application/x-shockwave-flash” data=”myflashmovie.swf”
pluginspage=”http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Vers
ion=ShockwaveFlash”
width=”100” height=”100”></object>
Including parameters
Sometimes an object requires additional parameters before it can start running. To specify parameters for
an embedded object, use the
<param/>
element with its
name
and
value
attributes:
<object type=”application/x-shockwave-flash” data=”myflashmovie.swf”
width=”100” height=”100”>
<param name=”message” value=”Hello World!” />
</object>
Each object can have any number of parameters. Including parameters that aren’t necessary doesn’t
have any negative effect.
Netscape 4.x
The old Netscape 4.x browsers don’t support the
<object/>
element, so you use the old Netscape pro-
prietary
<embed/>
element. The
<embed/>
element accepts most of the same attributes as
<object/>
(indeed,
<object/>
was modeled after
<embed/>
), except the
src
attribute is used instead of
data
:
<embed type=”application/x-shockwave-flash” src=”myflashmovie.swf”
width=”100” height=”100”>
<param name=”message” value=”Hello World!” />
</embed>
As you can see, this approach is very similar to using
<object/>
. The problem is that newer browsers
don’t support this element (it has officially been deprecated). So if you plan on supporting Netscape 4.x,
the preferred solution is to use
<object/>
with an
<embed/>
element inside of it, such as in the following:
<object type=”application/x-shockwave-flash” data=”myflashmovie.swf”
width=”100” height=”100”>
<param name=”message” value=”Hello World!” />
<embed type=”application/x-shockwave-flash” src=”myflashmovie.swf”
width=”100” height=”100”>
<param name=”message” value=”Hello World!” />
</embed>
</object>
Using this approach, the newer browsers ignore the
<embed/>
element and use
<object/>
to embed
the file; Netscape 4.x ignores
<object/>
and uses
<embed/>
to embed the file.
534
Chapter 18
21_579088 ch18.qxd 3/28/05 11:43 AM Page 534


JavaScript EditorFree JavaScript Editor     Ajax Editor


©