tags:

views:

40

answers:

3

when we place flash files in our websites, it OFF-COURSE requires flash player on client machines, and prompts to install flash player...

is there some php code using which i can check weather there is flash player on the client machine and if not then instead of placing\embedding a flash file i place an images over there...

cuz in my specific case flash is not that much important... it is just for cosmetics, an animation... which i can replace by a gif or a simple jpeg doesnot matter...

but can i do it

+3  A: 

swfobject can help with this.

You can just place the content to be shown if flash cannot be displayed in the code where the flash object should be, and point the script to it.

In code :

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title>TestFlash</title>

    <!--import the swfobject library /-->
    <script type="text/javascript" src="swfobject.js"></script>

    <!--Define which div (by ID) gets replaced if flash is present /-->
    <script type="text/javascript">
        swfobject.embedSWF("myContent.swf", "flash1", "300", "120", "9.0.0");
    </script>

</head>

<body>

    <h1>We are testing some flash</h1>
    <hr />

    <div id="flash1">
        <!-- This stuff will show if flash is not present on the machine  /-->
        <img src="/img/image1.jpg" />
    </div>

    <hr />
    <h2>this is a footer</h2>


</body>
</html>
Powertieke
how about this http://stackoverflow.com/questions/3805138/html-php-flash-player-detection-technique/3805936#3805936
Junaid Saeed
A: 

See this article - http://www.adobe.com/devnet/flash/articles/fp8_detection.html

Adobe have got this sorted now so you can present alternative content / direct users to install flash / detect which version of flash user has and then install latest version if needed from your website without having to visit adobe site.

A little bit of work to get this in place so depends on how important it is that user is using flash or if the alternative content would work just as well. but for delivering flash content and being sure that the user will have correct version installed the Flash Detection Kit works great.

undefined
... I re-read your question and while my suggestion is good for detecting flash version is probably overkill for your situation. I would look at using swfobject as suggested by powertieke - ive voted that answer up.
undefined
dear, no offense but i said flash is important for me, its just for cosmetics, which means if 10% of people who visit don't have flash player installed then they will just see an image, i don't want to force any installations or crooks to do it.. i just need `detection` `->` `placement\alternative`
Junaid Saeed
how about this http://stackoverflow.com/questions/3805138/html-php-flash-player-detection-technique/3805936#3805936
Junaid Saeed
A: 

how about

<?
// 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)
{
        // EMBED
} else {
       // IMG
};

?> 
Junaid Saeed
And this will work how? Where and how is `$hasFlash` defined?
Powertieke
Doesn't work for all browsers I've been told
Powertieke
according to my googling doesn't work for Safari Mac
Junaid Saeed