Does anyone have an example of script that can work reliably well across IE/Firefox to detect if the browser is capable of displaying embedded flash content. I say reliably because I know its not possible 100% of the time.
I agree with Max Stewart. SWFObject is the way to go. I'd like to supplement his answer with a code example. This ought to to get you started:
Make sure you have included the swfobject.js
file (get it here):
<script type="text/javascript" src="swfobject.js"></script>
Then use it like so:
if(swfobject.hasFlashPlayerVersion("9.0.115"))
{
alert("You have the minimum required flash version (or newer)");
}
else
{
alert("You do not have the minimum required flash version");
}
Replace "9.0.115" with whatever minimum flash version you need. I chose 9.0.115 as an example because that's the version that added h.264 support.
If the visitor does not have flash, it will report a flash version of "0.0.0", so if you just want to know if they have flash at all, use:
if(swfobject.hasFlashPlayerVersion("1"))
{
alert("You have flash!");
}
else
{
alert("You do not flash :-(");
}
SWFObject is very reliable. I have used it without trouble for quite a while.
I know this is an old post, but I've been looking for a while and didn't find anything.
I've implemented the JavaScript Flash Detection Library.
It works very well and it is documented for quick use. It literally took me 2 minutes. Here is the code I wrote in the header:
<script src="Scripts/flash_detect.js"></script>
<script type="text/javascript">
if (!FlashDetect.installed) {
alert("Flash is required to enjoy this site.");
} else {
alert("Flash is installed on your Web browser.");
}
</script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With