How can I use javascript/jQuery/etc to detect if Flash is installed and if it isn't, display a div that contains information informing the user that they need to install flash?
views:
2199answers:
3
+4
Q:
How can I detect if Flash is installed and if not, display a hidden div that informs the user?
+7
A:
use swfobject. it replaces a div with the flash if it is installed. see http://code.google.com/p/swfobject/ Josh
Josh
2009-06-15 20:40:12
+1
A:
You can use navigator.mimeTypes.
if (navigator.mimeTypes ["application/x-shockwave-flash"] == undefined)
$("#someDiv").show ();
AlbertEin
2009-06-15 20:44:19
-1 Does not seem to work in IE7.
Josef
2010-07-14 16:52:53
+1
A:
if swfobject wont suffice, or you need to create something a little more bespoke try this. It works with 7 and 8
var hasFlash = false;
try {
var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if(fo) hasFlash = true;
}catch(e){
if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash = true;
}
Drewid
2010-07-26 15:28:20
this works nice if you just want to detect if it is installed and not necessarily display a swf either way.
ctrlShiftBryan
2010-10-13 20:03:56