HTML\PHP : Flash Player detection technique
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 co开发者_StackOverflow社区smetics, an animation... which i can replace by a gif or a simple jpeg doesnot matter...
but can i do it
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>
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.
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
};
?>
精彩评论