Search code examples
javascriptjqueryflashgoogle-chromeswfobject

Force SWFObject to use EMBED instead of OBJECT


Is it possible to force SWFobject to embed flash using the embed tag instead of the default object tag? Right now I’m using this:

swfobject.embedSWF(url, 'player', width, height, "8", null, null, params, attrs)

This results in something like:

<object type="application/x-shockwave-flash" id="player" data="/player.swf">
    <param name="allowScriptAccess" value="always">
</object>

But I would like to embed using embed instead for Chrome, as I suspect that I can solve some of chromes mysterious flash bugs, such as position:fixed.


Solution

  • Short answer: nope.

    A key goal for SWFObject 2.x was to avoid using the embed tag, as it isn't a standard in HTML 4 or XHTML, and doesn't support fallback content. Therefore, there is no embed option in SWFObject 2. (FWIW, SWFObject 2.x predates HTML5 and the codification of embed as a standard.)

    You could try using SWFObject 1.5, which used embed for IE and object for everything else, but you'd have to modify the source code to add a fork for Chrome.

    Here's what I'd do if I were in your shoes:

    1. Try the SWFObject 2.3 beta. It still uses the object element, but has many updates.
    2. Try hand-coding an embed tag to see if it fixes your issues. There's some sample code in this article that you can modify to suit your needs.