How can I detect if Flash is installed and if not, display a hidden div that informs the user?

KingNestor picture KingNestor · Jun 15, 2009 · Viewed 118.6k times · Source

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?

Answer

Drewid picture Drewid · Jul 26, 2010

If swfobject won't suffice, or you need to create something a little more bespoke, try this:

var hasFlash = false;
try {
    hasFlash = Boolean(new ActiveXObject('ShockwaveFlash.ShockwaveFlash'));
} catch(exception) {
    hasFlash = ('undefined' != typeof navigator.mimeTypes['application/x-shockwave-flash']);
}

It works with 7 and 8.