Client-side object | |
Implemented in | Navigator 3.0 |
Created by
Plugin
objects are predefined JavaScript objects that you access through the navigator.plugins
array.
Description
A Plugin
object is a plug-in installed on the client. A plug-in is a software module that the browser can invoke to display specialized types of embedded data within the browser. The user can obtain a list of installed plug-ins by choosing About Plug-ins from the Help menu.
Each Plugin
object is itself array containing one element for each MIME type supported by the plug-in. Each element of the array is a MimeType
object. For example, the following code displays the type
and description
properties of the first Plugin
object's first MimeType
object.
myPlugin=navigator.plugins[0]
The preceding code displays output similar to the following:
myMimeType=myPlugin[0]
document.writeln('myMimeType.type is ',myMimeType.type,"<BR>")
document.writeln('myMimeType.description is ',myMimeType.description)myMimeType.type is video/quicktime
The
myMimeType.description is QuickTime for Windows Plugin
object lets you dynamically determine which plug-ins are installed on the client. You can write scripts to display embedded plug-in data if the appropriate plug-in is installed, or display some alternative information such as images or text if not.
Plug-ins can be platform dependent and configurable, so a Plugin
object's array of MimeType
objects can vary from platform to platform, and from user to user.
Each Plugin
object is an element in the plugins
array.
When you use the EMBED
tag to generate output from a plug-in application, you are not creating a Plugin
object. Use the document.embeds
array to refer to plug-in instances created with EMBED
tags. See the document.embeds
array.
| A description of the plug-in. |
| Name of the plug-in file on disk. |
|
Number of elements in the plug-in's array of MimeType objects.
|
| Name of the plug-in. |
Examples
Example 1. The user can obtain a list of installed plug-ins by choosing About Plug-ins from the Help menu. To see the code the browser uses for this report, choose About Plug-ins from the Help menu, then choose Page Source from the View menu.
Example 2. The following code assigns shorthand variables for the predefined LiveAudio properties.
var myPluginName = navigator.plugins["LiveAudio"].name
Example 3. The following code displays the message "LiveAudio is configured for audio/wav" if the LiveAudio plug-in is installed and is enabled for the
var myPluginFile = navigator.plugins["LiveAudio"].filename
var myPluginDesc = navigator.plugins["LiveAudio"].description"audio/wav"
MIME type:
var myPlugin = navigator.plugins["LiveAudio"]
Example 4. The following expression represents the number of MIME types that Shockwave can display:
var myType = myPlugin["audio/wav"]
if (myType && myType.enabledPlugin == myPlugin)
document.writeln("LiveAudio is configured for audio/wav")navigator.plugins["Shockwave"].length
Example 5. The following code displays the name
, filename
, description
, and length
properties for each Plugin
object on a client:
document.writeln("<TABLE BORDER=1><TR VALIGN=TOP>",
The preceding example displays output similar to the following:
"<TH ALIGN=left>i",
"<TH ALIGN=left>name",
"<TH ALIGN=left>filename",
"<TH ALIGN=left>description",
"<TH ALIGN=left># of types</TR>")
for (i=0; i < navigator.plugins.length; i++) {
document.writeln("<TR VALIGN=TOP><TD>",i,
"<TD>",navigator.plugins[i].name,
"<TD>",navigator.plugins[i].filename,
"<TD>",navigator.plugins[i].description,
"<TD>",navigator.plugins[i].length,
"</TR>")
}
document.writeln("</TABLE>")
See also
MimeType
, document.embeds
Properties
description
A human-readable description of the plug-in. The text is provided by the plug-in developers.
Property of |
Plugin
|
Read-only | |
Implemented in | Navigator 3.0 |
filename
The name of a plug-in file on disk.
Property of |
Plugin
|
Read-only | |
Implemented in | Navigator 3.0 |
Description
The filename
property is the plug-in program's file name and is supplied by the plug-in itself. This name may vary from platform to platform.
Examples
See the examples for Plugin
.
length
The number of elements in the plug-in's array of MimeType
objects.
Property of |
Plugin
|
Read-only | |
Implemented in | Navigator 3.0 |
name
A string specifying the plug-in's name.
Property of |
Plugin
|
Read-only | |
Implemented in | Navigator 3.0 |
Security
Navigator 3.0: This property is tainted by default. For information on data tainting, see "JavaScript Security".
Description
The plug-in's name, supplied by the plug-in itself. Each plug-in should have a name that uniquely identifies it.
Last Updated: 10/31/97 12:32:33