You are here: Reference > JavaScript > client-side > browser > objects > plugins

plugins collection

Browser support:
Represents a collection of all installed plugins in the browser.
Note that Internet Explorer supports the plugins collection but it is always empty and there is no way to get the installed plugins in this browser.

Syntax:

Properties that reference the object:
object.plugins
Related objects:
The base interface, through which you can add new functionalities to the plugins collection, is the PluginArray interface.

Possible members:

Properties:
length
Returns an integer that specifies the number of the installed plugins in the browser.

This property is read-only.
Methods:
[nameOrIndex]
Returns a plugin object from the current collection by name or index.

Parameters:

nameOrIndex
Required. A string that specifies the name or a zero-based integer that specifies the position of the plugin to retrieve.

Return value:

Returns a plugin object.
item (index)
Returns a plugin object from the current collection by position.

Parameters:

index
Required. Zero-based integer that specifies the position of the plugin to retrieve.

Return value:

Returns a plugin object.
namedItem (name)
Returns a plugin object from the current collection by name.

Parameters:

name
Required. String that specifies the name of the plugin to retrieve.

Return value:

Returns a plugin object.
refresh
Refreshes the plugins collection to make the newly installed plugins available.

Example HTML code 1:

This example illustrates the use of the plugins collection:
<head>
    <script type="text/javascript">
        function GetPluginsDesc () { 
            var resTable = document.getElementById ("resTable");
 
            if ('plugins' in navigator) {
                var plugins = navigator.plugins;
                for (var i=0; i < plugins.length; i++) {
                    resTable.insertRow (i);

                    resTable.rows[i].insertCell (0);
                    resTable.rows[i].cells[0].innerHTML = plugins[i].name;

                    resTable.rows[i].insertCell (1);
                    resTable.rows[i].cells[1].innerHTML = plugins[i].description;
                }
            } else {
                alert ("Your browser doesn't support this property!");
            }
        }
    </script>
</head>
<body onload="GetPluginsDesc ()">
    Installed plugins in your browser:
    <table border="1px">
        <thead style="font-weight: bold;">
            <tr>
                <td>Name</td>
                <td>Description</td>
            </tr>
        </thead>
        <tbody id="resTable">
        </tbody>
    </table>
</body>
Did you find this example helpful? yes no

External links:

User Contributed Comments

Post Content

Post Content