View Full Version : detect flash with PHP for users where javascript is disabled

02-05-2007, 07:05 AM
// Search through the HTTP_ACCEPT header for the Flash Player MIME type.
if (strstr($_SERVER['HTTP_ACCEPT'], 'application/x-shockwave-flash'))
$hasFlash = true;

if ($hasFlash)
} else {


But it does not work for Safari Mac

Adobe's Flash detection kit pdf has to say something about this:-

"The following issues with server side detection should be closely noted. Internet Explorer on Mac OS is hard-coded to accept '*/*' and cannot be modified dynamically. Secondly, users can manually uninstall Flash Player by deleting the executable itself. This casuses the custom accept header to be “orphaned” such that server detection logic thinks Flash has been installed, when in fact it is no longer available. It is also possible to disable ActiveX controls through the Windows XP Service Pack 2 security settings, which will similarly cause the custom accept header to be orphaned."

So is there any foolproof way to detect flash with PHP (for users who have javascript disabled) ?

02-05-2007, 10:04 AM
I think it would better if you put a small flash file on the nonflash page that redirects the user to the flash page using actionscript inside of the flash. If no redirection occurs well then obviously something is preventing them from the flash.

02-05-2007, 03:07 PM
You must have JavaScript enabled!

That's cheating though. ;)

02-05-2007, 07:42 PM
More people have flash disabled than Javascript and anyone with flash should certainly have javascript.

02-07-2007, 07:40 AM
That did the trick

For All:

I have just used a small width/height:1/1 flash where i have just written
getURL("flash.html") (which will redirect to my flash file)


<meta http-equiv="refresh" content="2;URL=noflash/index.html">

<html >

<meta http-equiv="refresh" content="2;URL=noflash/index.html">

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1" height="1" border="0" >
<param name="movie" value="detectflash.swf" />
<param name="quality" value="high" />
<embed src="detectflash.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1" height="1"></embed>


detectflash.swf contains only getURL("flash.html")