NavigatorPlugins.plugins

Returns a PluginArray object, listing the plugins installed in the application.

In Firefox 29 and later, enumeration of the navigator.plugins array may be restricted as a privacy measure. Applications that must check for the presence of a browser plugin should query navigator.plugins or navigator.mimeTypes by exact name instead of enumerating the navigator.plugins array and comparing every plugin's name. This privacy change does not disable any plugins; it just hides some plugin names from enumeration.

Syntax

JavaScript
var <var>plugins</var> = navigator.plugins;

plugins is used to access Plugin objects either by name or as an array of items.

The returned value is not a JavaScript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and namedItem("name") methods.

Examples

The following example function return for the Flash version.

JavaScript
function getFlashVersion() {
  var flash = navigator.plugins['Shockwave Flash'];
  if (flash === undefined) {
    // flash is not present
    return undefined;
  }
  return flash.version;
}

The following example prints out information about the installed plugin(s) for the high-level document.

JavaScript
var L = navigator.plugins.length;

document.write(
  L.toString() + " Plugin(s)<br>" +
  "Name | Filename | description<br>"
);

for(var i = 0; i < L; i++) {
  document.write(
    navigator.plugins[i].name +
    " | " +
    navigator.plugins[i].filename +
    " | " +
    navigator.plugins[i].description +
    " | " +
    navigator.plugins[i].version +
    "<br>"
  );
}

Notes

The Plugin object exposes a small interface for getting information about the various plugins installed in your browser. A list of plugins is also available by entering about:plugins in the browser's Location bar.

Specification

This isn't defined in any specification.

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/navigatorplugins/plugins

API NavigatorPlugins Property Reference Référence