PluginArray

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Giao diện PluginArray được sử dụng để lưu trữ danh sách các đối tượng Plugin; nó được trả về bởi thuộc tính navigator.plugins. PluginArray không phải là mảng JavaScript, nhưng có thuộc tính length và hỗ trợ truy cập từng mục bằng ký hiệu ngoặc vuông (plugins[2]), cũng như thông qua các phương thức item(index)namedItem("name").

Note: Các thuộc tính riêng của đối tượng PluginArray không còn liệt kê được trong các phiên bản trình duyệt mới nhất.

Thuộc tính phiên bản

PluginArray.length Read only Deprecated

Số lượng plugin trong mảng.

Phương thức phiên bản

PluginArray.item Deprecated

Trả về Plugin tại chỉ số được chỉ định trong mảng.

PluginArray.namedItem Deprecated

Trả về Plugin với tên được chỉ định.

PluginArray.refresh Deprecated

Làm mới tất cả các plugin trên trang hiện tại, tùy chọn tải lại tài liệu.

Ví dụ

Hàm ví dụ sau trả về phiên bản của plugin Shockwave Flash.

js
const 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>`;

const table = document.getElementById("pluginTable");

for (let 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 ?? "";
}

Thông số kỹ thuật

Specification
HTML
# pluginarray

Tương thích trình duyệt