RE: [PHP] Flash detection
| From: | Jason Murray | Date: | Mon, 28 Aug 2000 02:25:35 +0000 |
| Subject: | RE: [PHP] Flash detection | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-13874@lists.php.net to get a copy of this message | ||
Bill wrote:
> There is a very easy and (I think) fool proof way to detect Flash.
> (I am not a Flash or Php expert, but I use this on both of my sites).
>
> Create a Flash movie that has only 2 frames.
> The 2nd frame should have the action to Get
URL(http://yourflashpage.html).
> Generate the Html file, and add a meta tag which redirects the browser
> to the non-flash page after (say) 10s.
I think that'll work, but it's still reliant on Flash being present.
Since PHP cannot check the incoming browser for Flash abilities, this needs
to be done in JavaScript. I pulled the following code together for Flash
detection on a site earlier this year, it seems to work reasonably well:
<SCRIPT LANGUAGE="JavaScript">
<!--
//Look for a version of Internet Explorer that supports ActiveX (i.e., one
that's
//running on a platform other than Mac or Windows 3.1) or a browser that
supports
//the plugin property of the navigator object and that has Flash Player
2.0
//installed.
if ((navigator.appName == "Microsoft Internet Explorer" &&
navigator.appVersion.indexOf("Mac") == -1 &&
navigator.appVersion.indexOf("3.1") == -1) ||
(navigator.plugins &&
navigator.plugins["Shockwave Flash"]) ||
navigator.plugins["Shockwave Flash 2.0"])
{ // Go ahead and play the Flash.
document.write('<TABLE CELLPADDING=0 CELLSPACING=0
BORDER=0><TR><TD>\n');
document.write('<OBJECT --blah-->\n');
document.write(' <PARAM --blah-->\n');
document.write(' <EMBED --blah--></EMBED>\n');
document.write('</OBJECT></TD></TR>\n');
document.write('</TABLE><BR>\n');
document.write('<A HREF="mainpage.php3"><B>Main
Menu</B></A>\n');
}
else
{ //Load a pre-defined HTML page without Flash Player into the browser
window.
window.location='mainpage.php3';
}
// -->
</SCRIPT>
Of course, you'll need to add a <NOSCRIPT> tag to do the <META>
redirection...
client didn't want it, so it's not here sorry :)
Jason
--
Jason Murray
jasonm@melbourneit.com.au
Web Design Team, Melbourne IT
Don't believe everything you're foretold.