Page 1 of 1
Check for Flash
Posted: Wed Apr 13, 2005 6:12 am
by Per
I was wondering if any of you has a nice little PHP code that checks if Flash is installed on visitors PC? Something like if flash do this, else do that...
Thanks in advance!
Posted: Wed Apr 13, 2005 6:42 am
by neophyte
Well here's what flash uses:
Code: Select all
<SCRIPT LANGUAGE=JavaScript1.1>
<!--
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypesї"e;application/x-shockwave-flash"e;]) ? navigator.mimeTypesї"e;application/x-shockwave-flash"e;].enabledPlugin : 0;
if ( plugin ) {
var words = navigator.pluginsї"e;Shockwave Flash"e;].description.split("e; "e;);
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("e;MSIE"e;)>=0
&& (navigator.appVersion.indexOf("e;Win"e;) != -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("e;ShockwaveFlash.ShockwaveFlash."e; & MM_contentVersion)))\n');
document.write('</SCR' + 'IPT\> \n');
}
if ( MM_FlashCanPlay ) {
//////////////////////////////FlASH CAN PLAY SO DO WHATEVER
document.write('<OBJECT classid="e;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"e;');
document.write(' codebase="e;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0"e; ');
document.write(' ID="e;YourFlashFile"e; WIDTH="e;207"e; HEIGHT="e;70"e; ALIGN="e;left"e;>');
document.write(' <PARAM NAME=movie VALUE="e;images/banners/YourFlashFile.swf"e;> <PARAM NAME=quality VALUE=high> <PARAM NAME=salign VALUE=L> <PARAM NAME=bgcolor VALUE=#FFFFFF> ');
document.write(' <EMBED src="e;images/yourflashfile.swf"e; quality=high salign=L bgcolor=#FFFFFF ');
document.write(' swLiveConnect=FALSE WIDTH="e;207"e; HEIGHT="e;70"e; NAME="e;YourImageName"e; ALIGN="e;left"e;');
document.write(' TYPE="e;application/x-shockwave-flash"e; PLUGINSPAGE="e;http://www.macromedia.com/go/getflashplayer"e;>');
document.write(' </EMBED>');
document.write(' </OBJECT>');
} else{
/////NO FLASH SO DO SOMETHING ELSE
document.write('<IMG SRC="e;images/yourImage.gif"e; WIDTH="e;207"e; HEIGHT="e;70"e; BORDER=0>');
}
//-->
</SCRIPT>
This code is generated by Flash when you publish your movie with html.
Hope that helps