Page 1 of 1
display flash if you have it, image if not
Posted: Thu Jul 27, 2006 12:43 pm
by Burrito
my boss just asked me to create a page that will display a flash animiation but should display a static image if the user's browser doesn't have flash installed.
I'm pretty sure it's not so simple as just putting both 'elements' on the page...but I'm not sure about the flash detection. I wrote a script a few years back that reported several browser settings (flash being one of them), but that was a pretty JS heavy endeavor....I'd like to avoid that if possible.
Posted: Thu Jul 27, 2006 12:53 pm
by neophyte
I don't know about the latest Flash release but MX had an export/publish option that created some JS to do just that. Here's what it looks like.
Code: Select all
<SCRIPT LANGUAGE=JavaScript1.1 type="text/javascript">
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.plugins["Shockwave Flash"].description.split(" ");
for (var i = 0; i < words.length; ++i)
{
if (isNaN(parseInt(words[i])))
continue;
var MM_PluginVersion = words[i];
}
var MM_FlashCanPlay = MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0
&& (navigator.appVersion.indexOf("Win") != -1)) {
document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
document.write('on error resume next \n');
document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write(' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ');
document.write(' ID="songmovie" WIDTH="150" HEIGHT="30" ALIGN="">');
document.write(' <PARAM NAME=movie VALUE="songmovie.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
document.write(' <EMBED src="songmovie.swf" quality=high bgcolor=#FFFFFF ');
document.write(' swLiveConnect=FALSE WIDTH="150" HEIGHT="30" NAME="songmovie" ALIGN=""');
document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">');
document.write(' </EMBED>');
document.write(' </OBJECT>');
} else{
document.write('<IMG SRC="songmovie.gif" WIDTH="150" HEIGHT="30" usemap="#songmovie" BORDER=0>');
}
//-->
</SCRIPT>
Posted: Thu Jul 27, 2006 2:29 pm
by Burrito
awesome thank you neophyte.
Posted: Sun Jul 30, 2006 6:57 am
by mojeIme
This looks cool, but i think that those who dont have flash installed ,are not worth of this.
Posted: Sun Jul 30, 2006 9:52 am
by Ambush Commander
This looks cool, but i think that those who dont have flash installed ,are not worth of this.
Personally, I have Flash disabled by default for all sites.
I also have Javascript disabled (you may want to add <noscript>).
Posted: Mon Jul 31, 2006 12:19 am
by JAB Creations
Code: Select all
<object>
<param></param>
<param></param>
<param></param>
<element>Alternative content here.</element>
</object>
So if you want an image in place of a Flash object if the Flash fails or is not installed...
Code: Select all
<object>
<param></param>
<param></param>
<param></param>
<img alt="" src="" title="" />
</object>
This is not well known but it is the proper way to do so. Disable Flash and reload your page with this code (modded to the way you want of course).
Best of luck!