Plugin
A plug-in module installed on the client.Created by
Plugin objects are predefined JavaScript objects that you access through the navigator.plugins array.
Description
APlugin 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/quicktimeThe
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.
Property Summary
| Property |
Description
|
|
Number of elements in the plug-in's array of
| |
|---|
Method Summary
This object inherits thewatch and unwatch methods from Object.
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"].nameExample 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"].lengthExample 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>")
| i | name | filename | description | # of types |
See also
MimeType, document.embeds
description
A human-readable description of the plug-in. The text is provided by the plug-in developers.filename
The name of a plug-in file on disk.Description
Thefilename 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 forPlugin.
length
The number of elements in the plug-in's array ofMimeType objects. name
A string specifying the plug-in's name.Security
JavaScript 1.1. This property is tainted by default. For information on data tainting, see the Client-Side JavaScript Guide.Description
The plug-in's name, supplied by the plug-in itself. Each plug-in should have a name that uniquely identifies it.Table of Contents | Previous | Next | Index
Last Updated: 05/28/99 12:00:11
