navigator.plugins is an array, so you use for each in modern browsers and iterate with the index differently:
function pluginActive(pname) { for (var i = 0;i < navigator.plugins.length;i++) { if (navigator.plugins[i].name.indexOf(pname) != -1) { return true; } } return false; } console.log("Flash plugin " + (pluginsActive("Shockwave Flash") ? "active" : "not present"));
You cannot distinguish plugins that are disabled and not present. Keep in mind that you may have to restart your browser before activating / deactivating the plugin.
source share