var nav = navigator;
var module = {
Plugins: {
list: function() {
var list = [];
if (nav.plugins) {
for (var i = 0, l = nav.plugins.length; i < l; i++)
{
var plugin = {};
if (nav.plugins[i].name) {
plugin.name = nav.plugins[i].name;
}
if (nav.plugins[i].description) {
plugin.description = nav.plugins[i].description;
}
list[list.length] = plugin;
}
}
return list;
},
get: function (name) {
for (var i = 0, l = nav.plugins.length; i < l; i++)
{
if (nav.plugins[i].name === name) {
return nav.plugins[i];
}
}
return undefined;
},
Flash: {
version: function () {
var vers = 0;
var plugin = module.Plugins.get("Shockwave Flash");
if (plugin !== undefined) {
vers = parseFloat(plugin.description.match(/d{1,2}/));
} else {
// Test IE
var minVersion = 9;
var maxVersion = 12;
for (var i = maxVersion; i >= minVersion; i--)
{
try
{
var test = new win.ActiveXObject("ShockwaveFlash.ShockwaveFlash." + i);
return i;
}
catch (e) { /* nothing to see here*/ }
}
}
return vers;
}
},
Silverlight: {
version: function () {
var vers = 0;
var plugin = module.Plugins.get("Silverlight Plug-In");
if (plugin !== undefined) {
vers = parseFloat(plugin.description.match(/d{1,2}/));
} else {
// Test IE
try {
var control = new win.ActiveXObject('AgControl.AgControl');
if (control) {
var minVersion = 3;
var maxVersion = 6;
for (var i = minVersion; i <= maxVersion; i++)
{
if (control.isVersionSupported(i + ".0")) {
vers = i;
}
}
}
} catch (e) { /* nothing to see here*/ }
}
return vers;
}
}
}
};
console.log(module.Plugins.Flash.version());
alert(module.Plugins.Flash.version());
http://www.pinlady.net/PluginDetect/guide/