Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Detecting Flash, and if not present load a jpg instead of a swf???

Status
Not open for further replies.

fiuPikeOY

Programmer
Jun 14, 2004
143
US
Hello,

I have a page with a top banner in Flash, but if the user doesn't have Flash I want to display a jpg banner where the Flash was supposed to be. I found this script to do the switch from the swf to the jpg, but I couldn't find the script to detect Flash. Anybody?

<script language="JavaScript">
<!--

if (isFlash5 && params["flash"]) {
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" width="134" height="202">');
document.write('<param name=movie value="flash/homepage.swf">');
document.write('<param name=quality value=high>');
document.write('<param name="menu" value="false">');
document.write('<param name="wmode" value="transparent">');
document.write('<embed src="flash/homepage.swf" quality=high menu="false" pluginspage=" type="application/x-shockwave-flash" width="134" height="202">');
document.write('</embed>');
document.write('</object>');

} else {

document.write('<img src="graphics/pictures/homepage.jpg" width="134" height="202">');

}
// -->
</script>
 

Macromedia provide a tool, called (strangely enough) the "Macromedia Flash Detection Kit".

It should be on your Flash installation CD - check your manual for details. Failing that, try Macromedia's website, or the Flash forum.

Hope this helps,
Dan
 
Umm.. isn't that what that script is meant to do?

I'm no JavaScript expert but isn't that conditional IF statment saying...

Code:
If Flash is available to the browser then display this flash file with these parameters.
Else
Show this picture.

There is a nice article on A List Apart about embedding flash and adhering to web standards. There is also a method for loading an image if Flash isn't available.. and it's alot neater and doesn't employ JavaScript. (I have not tested it though).

 
I think the problem is in populating the variable [tt]isFlash5[/tt] depending on whether Flash is installed or not.

Good steer to that ALA article though, not only does it sidestep all that javascript and Flash detection stuff, but it produces valid markup too. Read it here:
-- Chris Hunt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top