PluginArray

这是 实验性技术
检查 浏览器兼容性表格 在生产中使用这之前。

PluginArray interface is used to store a list of Plugin objects describing the available plugins ; it's returned by the window.navigator.plugins property. The PluginArray 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" ) 方法。

注意 : Own properties of PluginArray objects are no longer enumerable in the latest browser versions.

特性

PluginArray.length 只读
The number of plugins in the array.

方法

PluginArray.item
返回 Plugin at the specified index into the array.
PluginArray.namedItem
返回 Plugin with the specified name.
PluginArray.refresh
Refreshes all plugins on the current page, optionally reloading documents.

范例

The following example function returns the version of the Shockwave Flash plugin.

var pluginsLength = navigator.plugins.length;
document.body.innerHTML = pluginsLength + " Plugin(s)<br>"
  + '<table id="pluginTable"><thead>'
  +'<tr><th>Name</th><th>Filename</th><th>description</th><th>version</th></tr>'
  +'</thead><tbody></tbody></table>';
var table = document.getElementById('pluginTable');
for(var i = 0; i < pluginsLength; i++) {
  let newRow = table.insertRow();
  newRow.insertCell().textContent = navigator.plugins[i].name;
  newRow.insertCell().textContent = navigator.plugins[i].filename;
  newRow.insertCell().textContent = navigator.plugins[i].description;
  newRow.insertCell().textContent = navigator.plugins[i].version?navigator.plugins[i].version:"";
}
					

The following example displays information about the installed plugin(s).

var pluginsLength = navigator.plugins.length;
document.write(
  pluginsLength.toString() + " Plugin(s)<br>" +
  "Name | Filename | description<br>"
);
for(var i = 0; i < pluginsLength; i++) {
  document.write(
    navigator.plugins[i].name +
    " | " +
    navigator.plugins[i].filename +
    " | " +
    navigator.plugins[i].description +
    " | " +
    navigator.plugins[i].version +
    "<br>"
  );
}
					

规范

规范 状态 Comment
HTML Living Standard
The definition of 'PluginArray' in that specification.
实时标准 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
PluginArray Chrome Yes Edge ≤18 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android No Safari iOS Yes Samsung Internet Android Yes
item Chrome Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Chrome Android Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Firefox Android Yes Opera Android No Safari iOS Yes Samsung Internet Android Yes
Yes
Starting with Samsung Internet 7.0, method parameters are required instead of optional.
length Chrome Yes Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes Chrome Android Yes Firefox Android Yes Opera Android No Safari iOS Yes Samsung Internet Android Yes
namedItem Chrome Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Chrome Android Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Firefox Android Yes Opera Android No Safari iOS Yes Samsung Internet Android Yes
Yes
Starting with Samsung Internet 7.0, method parameters are required instead of optional.
refresh Chrome Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Edge 12 Firefox Yes IE ? Opera Yes Safari Yes WebView Android Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Chrome Android Yes
Yes
Starting with version 59, method parameters are required instead of optional.
Firefox Android Yes Opera Android No Safari iOS Yes Samsung Internet Android Yes
Yes
Starting with Samsung Internet 7.0, method parameters are required instead of optional.

图例

完整支持
完整支持
不支持
不支持
兼容性未知
兼容性未知
见实现注意事项。

In addition to listing each plugin as a pseudo-array by zero-indexed numeric properties, Firefox provides properties that are the plugin name directly on the PluginArray object.

  1. PluginArray
  2. Related pages for HTML DOM
    1. BeforeUnloadEvent
    2. DOMStringMap
    3. ErrorEvent
    4. GlobalEventHandlers
    5. HTMLAnchorElement
    6. HTMLAreaElement
    7. HTMLAudioElement
    8. HTMLBRElement
    9. HTMLBaseElement
    10. HTMLBaseFontElement
    11. HTMLBodyElement
    12. HTMLButtonElement
    13. HTMLCanvasElement
    14. HTMLContentElement
    15. HTMLDListElement
    16. HTMLDataElement
    17. HTMLDataListElement
    18. HTMLDialogElement
    19. HTMLDivElement
    20. HTMLDocument
    21. HTMLElement
    22. HTMLEmbedElement
    23. HTMLFieldSetElement
    24. HTMLFormControlsCollection
    25. HTMLFormElement
    26. HTMLFrameSetElement
    27. HTMLHRElement
    28. HTMLHeadElement
    29. HTMLHeadingElement
    30. HTMLHtmlElement
    31. HTMLIFrameElement
    32. HTMLImageElement
    33. HTMLInputElement
    34. HTMLIsIndexElement
    35. HTMLKeygenElement
    36. HTMLLIElement
    37. HTMLLabelElement
    38. HTMLLegendElement
    39. HTMLLinkElement
    40. HTMLMapElement
    41. HTMLMediaElement
    42. HTMLMetaElement
    43. HTMLMeterElement
    44. HTMLModElement
    45. HTMLOListElement
    46. HTMLObjectElement
    47. HTMLOptGroupElement
    48. HTMLOptionElement
    49. HTMLOptionsCollection
    50. HTMLOutputElement
    51. HTMLParagraphElement
    52. HTMLParamElement
    53. HTMLPictureElement
    54. HTMLPreElement
    55. HTMLProgressElement
    56. HTMLQuoteElement
    57. HTMLScriptElement
    58. HTMLSelectElement
    59. HTMLShadowElement
    60. HTMLSourceElement
    61. HTMLSpanElement
    62. HTMLStyleElement
    63. HTMLTableCaptionElement
    64. HTMLTableCellElement
    65. HTMLTableColElement
    66. HTMLTableDataCellElement
    67. HTMLTableElement
    68. HTMLTableHeaderCellElement
    69. HTMLTableRowElement
    70. HTMLTableSectionElement
    71. HTMLTemplateElement
    72. HTMLTextAreaElement
    73. HTMLTimeElement
    74. HTMLTitleElement
    75. HTMLTrackElement
    76. HTMLUListElement
    77. HTMLUnknownElement
    78. HTMLVideoElement
    79. HashChangeEvent
    80. History
    81. ImageData
    82. Location
    83. MessageChannel
    84. MessageEvent
    85. MessagePort
    86. Navigator
    87. NavigatorGeolocation
    88. NavigatorID
    89. NavigatorLanguage
    90. NavigatorOnLine
    91. NavigatorPlugins
    92. PageTransitionEvent
    93. Plugin
    94. PopStateEvent
    95. PortCollection
    96. PromiseRejectionEvent
    97. RadioNodeList
    98. Transferable
    99. ValidityState
    100. Window
    101. WindowBase64
    102. WindowEventHandlers
    103. WindowTimers