Flash tag that works cross browser...

User 364143 Photo


Guest
5,410 posts

This topic has been bothering me for some time so I did some Google magic and stumbled across this change to the object tag that works in the latest browsers that I tested it in.


<object data="myflash.swf" type="application/x-shockwave-flash" id="myflash" width="100" height="200">
<param name="movie" value="myflash.swf" />
<param name="bgcolor" value="#ffffff" />
<param name="height" value="100" />
<param name="width" value="200" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="allowscriptaccess" value="samedomain" />
</object>


Tested in:

IE8
FF
Opera
Chrome
Safari (Windows)

The only thing that this won't do is prompt the visitor to install flash if they are missing it or has the wrong version (like the other tag code does). If anybody knows why else I shouldn't use it, please post your reasoning. I guess in a perfect world, we would not have to pick and choose our evils when it comes to cross browser support. :P
CoffeeCup... Yeah, they are the best!
User 463058 Photo


Ambassador
1,073 posts

That's the way I've been doing it. If Opera hasn't changed, it will still require the user to click to activate things, but they'll do that anyway when nothing happens the first time they click, even without an annoying message telling them to do so.

You can prompt the user to install flash by adding a line after the params. It will only show up if Flash Player isn't installed.

<object data="myflash.swf" type="application/x-shockwave-flash" id="myflash" width="100" height="200">
<param name="movie" value="myflash.swf" />
<param name="bgcolor" value="#ffffff" />
<param name="height" value="100" />
<param name="width" value="200" />
<param name="quality" value="high" />
<param name="menu" value="false" />
<param name="allowscriptaccess" value="samedomain" />
<p>Adobe <a href="http://get.adobe.com/flashplayer/">Flash Player</a> is required to view this content.</p>
</object>
User 364143 Photo


Guest
5,410 posts

Thanks for the tip, Cary. I'll certainly add that <p> link. ;)
CoffeeCup... Yeah, they are the best!
User 364143 Photo


Guest
5,410 posts

Well, I went back to using the object with embed tag method. I didn't like the white box waiting for the flash to load and it appeared to load much slower on a page with lots going on. Sounded like a good idea but I think i'll stick to not validating the embed tag for now.

I do have a question. If the embed tag is not balid markup but all non IE browsers require it, why does W3C not allow it? What is the valid way to display Flash in these browsers and validate?
CoffeeCup... Yeah, they are the best!
User 463058 Photo


Ambassador
1,073 posts

I'm not for certain, but I thought I had heard that embed was going to be part of the HTML5 standard.
User 462238 Photo


Registered User
144 posts

<object id="flash1(edit if necessary)" data="___________.swf" height="___"
type="application/x-shockwave-flash" width="___">
<param name="movie" value="___________.swf"/></object>

This works in EW and the code is W3C compatible. I haven't run across any major browser issues. This is the recommended code for EW compatibility issues.
User 486210 Photo


Registered User
4 posts

Have been trying to use the above fix to avoid the embed tag, but how do I get it to not play the flash on startup?
User 463058 Photo


Ambassador
1,073 posts

You use params to control that, if the flash you're embedding has the option and you know what param it requires.
User 486210 Photo


Registered User
4 posts

This works with everything but Flash Firestarter movies. Tried substituting the same way and Firefox just prompts to get flash player. Why?

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.