I need to check whether Flash player is installed and enabled or not in IE/Chrome.
((typeof navigator.plugins != 'undefined' && typeof navigator.plugins['Shockwave Flash'] == 'object') || (window.ActiveXObject && (new ActiveXObject('ShockwaveFlash.ShockwaveFlash')) != false));
and
!!(navigator.mimeTypes["application/x-shockwave-flash"] || window.ActiveXObject && new ActiveXObject('ShockwaveFlash.ShockwaveFlash'));
Both are fine for all the browsers in all OS except Chrome.For chrome it gives true even if I disable the Flash Player. But for IE it is behaving differently on different systems also not working in IE6 at all. How to check for IE/Chrome if flash is installed and enabled or not.
Too tired to write up a whole thing, so here is a fiddle with some flash/silverlight detection i wrote a while back. Feel free to play with it and remove the silverlight part if you don't need it.
It basically boils down to looping through all plug ins like this:
function get (name) {
for (var i = 0, l = navigator.plugins.length; i < l; i++)
{
if (navigator.plugins[i].name === name) {
return navigator.plugins[i];
}
}
return undefined;
}
http://jsfiddle.net/nQ7fk/
I guess you might have already ruled this out but I would recommend using swfobject to manage your flash insertion:
It does have features that let you detect if flash is installed and it also can trigger the installation process and manage your general flash insertion in a cross-browser, standards compliant way.
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