这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
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>"
);
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
HTML 实时标准
The definition of 'PluginArray' in that specification. |
实时标准 | 初始定义。 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
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
|
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
|
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
|
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
|
refresh
|
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
|
完整支持
不支持
兼容性未知
见实现注意事项。
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.
PluginArray
BeforeUnloadEvent
DOMStringMap
ErrorEvent
GlobalEventHandlers
HTMLAnchorElement
HTMLAreaElement
HTMLAudioElement
HTMLBRElement
HTMLBaseElement
HTMLBaseFontElement
HTMLBodyElement
HTMLButtonElement
HTMLCanvasElement
HTMLContentElement
HTMLDListElement
HTMLDataElement
HTMLDataListElement
HTMLDialogElement
HTMLDivElement
HTMLDocument
HTMLElement
HTMLEmbedElement
HTMLFieldSetElement
HTMLFormControlsCollection
HTMLFormElement
HTMLFrameSetElement
HTMLHRElement
HTMLHeadElement
HTMLHeadingElement
HTMLHtmlElement
HTMLIFrameElement
HTMLImageElement
HTMLInputElement
HTMLIsIndexElement
HTMLKeygenElement
HTMLLIElement
HTMLLabelElement
HTMLLegendElement
HTMLLinkElement
HTMLMapElement
HTMLMediaElement
HTMLMetaElement
HTMLMeterElement
HTMLModElement
HTMLOListElement
HTMLObjectElement
HTMLOptGroupElement
HTMLOptionElement
HTMLOptionsCollection
HTMLOutputElement
HTMLParagraphElement
HTMLParamElement
HTMLPictureElement
HTMLPreElement
HTMLProgressElement
HTMLQuoteElement
HTMLScriptElement
HTMLSelectElement
HTMLShadowElement
HTMLSourceElement
HTMLSpanElement
HTMLStyleElement
HTMLTableCaptionElement
HTMLTableCellElement
HTMLTableColElement
HTMLTableDataCellElement
HTMLTableElement
HTMLTableHeaderCellElement
HTMLTableRowElement
HTMLTableSectionElement
HTMLTemplateElement
HTMLTextAreaElement
HTMLTimeElement
HTMLTitleElement
HTMLTrackElement
HTMLUListElement
HTMLUnknownElement
HTMLVideoElement
HashChangeEvent
历史
ImageData
定位
MessageChannel
MessageEvent
MessagePort
Navigator
NavigatorGeolocation
NavigatorID
NavigatorLanguage
NavigatorOnLine
NavigatorPlugins
PageTransitionEvent
Plugin
PopStateEvent
PortCollection
PromiseRejectionEvent
RadioNodeList
Transferable
ValidityState
Window
WindowBase64
WindowEventHandlers
WindowTimers