HTML and CSS Reference
In-Depth Information
attributes browsers recognize and what they mean.
The
object
element is better documented, more consistently supported in modern browsers, and more agnostic
about just what kind of content it loads and who renders it. Most important, whereas
embed
can have an infinite
number of possible attributes,
object
has just a few. Plug-in-specific parameters can be passed through
param
child elements, each of which has just two attributes—
name
and
value
—to identify the parameter being set.
This means
object
can be validated in a way
embed
never could be.
Potential Trade-offs
Some older browsers, including Netscape 4 and earlier and Internet Explorer for the Mac, do not recognize the
object
tag. To work around this you can include an
embed
element inside the
object
element like so:
<object type="application/x-shockwave-flash"
width="160" height="600" id="banner">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="banner.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#006699" />
<embed src="banner.swf" quality="high" bgcolor="#006699"
width="160" height="600" name="banner"
align="middle" allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
Browsers that don't recognize
object
will use the
embed
element. Browsers that do recognize
object
will ignore
it. Such documents are not valid. However, they do work well in browsers. In fact, this is close to what the Flash
authoring environment exports.
A somewhat more serious concern is that Internet Explorer will not stream Flash animations embedded like this.
It will download and play them, but that can take awhile for a large file. The trick here, named Flash Satay by
its discoverer Drew McLellan, is to embed an initial small Flash file whose only purpose is to load and stream the
second, actual Flash animation. The minimum you need in the loader movie is this ActionScript on the first
frame:
_root.loadMovie(_root.path,0);
The URL to the second, actual animation is in the
path
variable of the first animation's query string. Thus, your
object
element will look like this:
<object type="application/x-shockwave-flash"
data="first.swf?path=second.swf"
width="300" height="300">
<param name="movie" value="first.swf?path=second.swf" />
</object>
Another noticeable trade-off is one of developer education and convenience. The Flash authoring program
generates HTML for authors to include in web pages. However, this HTML is nonstandard and ugly. Using clean,
standard markup requires editing a lot of this by hand.
Mechanics
Search WWH ::
Custom Search