Javascript Flash Detect Script

Place this code in a .js file and link it in the head of your document:

function FlashInstalled()
{
result = false;
if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"])
{
result = navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin;
}
else if (document.all && (navigator.appVersion.indexOf("Mac")==-1))
{
eval ('try {var xObj = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if (xObj) result = true; xObj = null; } catch (e) {}');
}
return result;
}
function FlashWrite(url,width,height)
{
document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
document.write(' codebase="http://active.macromedia.com/flash4/cabs/swflash.cab#version=4,0,0,0" ');
document.write(' WIDTH=' + width + ' HEIGHT=' + height + '>');
document.write(' <PARAM NAME=movie VALUE="' + url + '"> <PARAM NAME=loop VALUE=false> <PARAM NAME=quality VALUE=best> <PARAM NAME=scale value=exactfit> <PARAM NAME=bgcolor VALUE=#CCFFFF> <PARAM NAME=menu value=false> ');
document.write(' <EMBED xsrc="' + url + '" quality=best bgcolor=#CCFFFF loop=false scale=exactfit menu=false ');
document.write(' swLiveConnect=FALSE WIDTH=' + width + ' HEIGHT=' + height);
document.write(' TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?
P1_Prod_Version=ShockwaveFlash">');
document.write(' </EMBED></OBJECT>');
}

You can call the above code flash.js file and link it in the head of your document like this:

<script language="JavaScript1.2" xsrc="flash.js" mce_src="flash.js" type="text/javascript"></script>

Then where you want your flash file to appear, place this code:

<script Language = "JavaScript" type="text/javascript">
if (FlashInstalled())
{
FlashWrite('images/flash/yourflashfile.swf',468,240);
}
else
{
var url = "linkyourflatimagetosomefile.php"
var image = "<img alt='Name of your flat image' xsrc='images/flash/yourstillimage.jpg' height=240 width=468 border=0>"
document.write(image.link(url));}</script>
<noscript><a xhref='linkyourflatimagetosomefile.php'><img alt='Name of your flat image' xsrc='images/flash/yourstillimage.jpg' height=240 width=468 border=0></a>
</noscript>

If the browser doesn’t have flash installed or doesn’t have java turned on, they will see yourstillimage.jpg instead of the flash file. Change the file width and height to match your .swf and image files.