Can I check which Flash plugin is running on my page

197 views Asked by At

I'm using JavaScript to see if the ShockwaveFlash plugin is on my page as an ActiveXObject. I'm also checking for the application/x-shockwave> I'm using swfobject to load the Flash on to the page.

I can check for which Flash Version I'm running but I'm not sure how to check for which installation of Flash is installed for the browser.

What I want to do is check to see if Flash for Other Browsers is installed on the machine.

Is this possible with JavaScript?

JavaScript Code

var hasFlash = false;
try {
    var fo = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
    if(fo) hasFlash = true;
    sendEventToServer("flash_not_found");
} catch(e){
    if(navigator.mimeTypes ["application/x-shockwave-flash"] != undefined) hasFlash =         true;
}
1

There are 1 answers

1
Wayne Smith On BEST ANSWER

Plugins are located here but I don't believe it is a W3C standard.

var myNavigator = window.navigator ? window.navigator : navigator;
var plugins = myNavigator.plugins
for (var key in plugins) { 
    document.write("<li>"+key+" : "+plugins[key]);
} 

Looking at the associated objects with for (in) we have an associated array where we have name and version.

document.write(navigator.plugins[0].name);
document.write(navigator.plugins[0].version);
document.write(navigator.plugins[0].description);

so you need to loop through them. The gobal object to start at is either window.navigator or navigator depending on browser. Your catch(e){ if(navigator. assumes its always navigator, but its not.