Answer edited on 2013.03.15 to increase the accuracy of information.
The list of supported plugins is available as an array in the navigator
object:
navigator.plugins
This API is non-standard , but all modern browsers implement it. Internet Explorer support dates back to at least IE7, but is not available in older versions of Opera.
navigator.plugins
has this basic structure:
PluginArray [ ... Plugin { description: "Java Plug-In 2 for NPAPI Browsers" filename: "JavaAppletPlugin.plugin" length: 17 name: "Java Plug-In 2 for NPAPI Browsers" }, ... ]
Here is a function that traverses navigator.plugins
and checks the name
property for a given string. It returns true
or false
if found.
function pluginEnabled(name) { var plugins = navigator.plugins, i = plugins.length, regExp = new RegExp(name, 'i'); while (i--) { if (regExp.test(plugins[i].name)) return true; } return false; }
Use it like this (case insensitive):
pluginEnabled('java'); pluginEnabled('flash');
source share