Reputation: 264
I am a newbie in webdesign and I´ve been wondering which is the modern way to embed swf objects.
I've been using the following html code:
<object id="flash1" data="presentacion/prototipe.swf" height="300" type="application/x-shockwave-flash" width="500">
<param name="movie" value="presentacion/prototipe.swf" />
</object>
However, I've noticed that some designers use a javascript to embed swf files. Like this one
<script type="text/javascript">
var flashvars = {
};
var params = {
menu: "false",
scale: "noScale",
allowFullscreen: "true",
allowScriptAccess: "always",
allowNetworking: "all",
bgcolor: "#ffffff",
base: "swf/"
};
var attributes = {
id:"flashMovie"
};
swfobject.embedSWF("swf/flash_movie.swf", "flashMovie", "550", "400", "9.0.0", "swf/expressinstall.swf", flashvars, params, attributes);
</script>
It seems that both ways produce the same results but: what are the shorfalls of these methods? which method is the newest ? Are there any compatibility issues regarding the web-browsers?
Thanks in advance.
Upvotes: 1
Views: 381
Reputation: 360662
Another reason is that swfobject() works around a patent-induced limitation in Internet Explorer - Microsoft got sued by a troll for embedding dynamic content in a web page. To bypass the patent, MS added a "click to activate" function on all embedded content (flash, java,, etc...). swfobject() implements a workaround for the workaround, to auto-activate this content without requiring a click.
Just goes to show how moronic software patents are...
Upvotes: 1
Reputation: 21838
swfobject (javascript) handles the compatibility among browsers and prevents your page from being invalid (which is common with certain settings).
Shortfalls for Javascript would include the fact that you have to load another request for the Javascript file, you rely on using Javascript and you have to wait for that to load client side. All of which I think are insignificant -- I believe it is the best method.
The XHTML method has the opposite pros/cons, does not require extra javascript, it can be valid per W3 standards (but I believe there are some limitations) and you have to worry about browser compatibility.
Upvotes: 1
Reputation: 17390
You want to use SWFObject because some browers don't support that HTML code that you provided.
Use SWFObject because it will determine what will work so that you don't have to. That way you don't have to know the cross-browser pitfalls. That is why it exists.
Upvotes: 1