views:

476

answers:

3

Hi, is it possible to detect if flash is installed using PHP. My aim is, that if it is installed it will play a flv file, and if not it will use another player eg; quicktime? If it is possible how do I go about doing it?

Thanks Tom

A: 

PHP can't detect this... only javascript can.

http://www.adobe.com/support/flash/how/shock/javaplugs/index.html

Webnet
+5  A: 

You cannot determine that on the server side (where PHP runs). You will have to detect it on the client side, using JavaScript, and either perform the wanted steps on the client side or communicating the result back to the server with a json/ajax/... request

You can download the Flash Player Detection Kit from Adobe

Dr. Sbaitso
A: 

There's a better approach to this -

Use SWFObject to embed your .swf file. This is pretty much industry standard these days, nobody who knows what they're doing uses the pre-built Flash embed code.

The reason SWFObject will help you is that you basically tell it to go find a div on your site and replace it with a div containing embedded Flash. If the user doesn't have Flash installed, no problem - it just continues to display the original div.

The idea, then, is that you put your alt-content into the div that's going to be replaced by your .swf. This works very nicely, and should be perfect for what you need.

Myk