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

plugin object

Browser support:
Contains information about an installed plug-in in the browser.
A plug-in can be associated with several MIME types. You can get details about these MIME types with the methods of the plugin object.

Syntax:

Properties that reference the object:
mimeType.enabledPlugin
Methods that return the object:
plugins.item (index)
plugins.namedItem (name)
The base interface, through which you can add new functionalities to the plugin object, is the Plugin interface.

Possible members:

Properties:
description
Returns the description supplied by the plugin manufacturer.
filename
Returns the file name of the current plugin with extension.
length
Returns an integer that specifies the number of associated MIME types.

This property is read-only.
name
Returns the name of the plugin specified by the application manufacturer.
Methods:
[nameOrIndexOfMime]
Returns a mimeType object that represents an associated MIME type, by name or by index.

Parameters:

nameOrIndexOfMime
Required. A zero-based integer that specifies the position or a string that specifies the name of the MIME type.

Return value:

Returns a mimeType object.
item (indexOfMime)
Returns a mimeType object that represents an associated MIME type, by index.

Parameters:

indexOfMime
Required. A zero-based integer that specifies the position of the MIME type.

Return value:

Returns a mimeType object.
namedItem (nameOfMime)
Returns a mimeType object that represents an associated MIME type, by name.

Parameters:

nameOfMime
Required. String that specifies the name of the MIME type.

Return value:

Returns a mimeType object.

Example HTML code 1:

This example illustrates the use of the plugin object:
<head>
    <script type="text/javascript">
        function GetPluginsDesc () {                
            var resTable = document.getElementById ("resTable");

            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;

                resTable.rows[i].insertCell (2);
                var mimes = "";
                for (var j=0; j < plugins[i].length; j++) {
                    mimes += plugins[i][j].description + " (type: " + plugins[i][j].type + ")<br />";
                }
                resTable.rows[i].cells[2].innerHTML = mimes;
            }
        }
    </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>
                <td>Associated MIME types</td>
            </tr>
        </thead>
        <tbody id="resTable">
        </tbody>
    </table>
</body>
Did you find this example helpful? yes no

Related pages:

External links:

User Contributed Comments

Post Content

Post Content