Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.arcetri.astro.it/irlab/doc/library/javascript/clientreference/plugin.htm
Дата изменения: Thu Oct 7 13:13:36 1999 Дата индексирования: Sat Dec 22 14:24:04 2007 Кодировка: Поисковые слова: m 101 |
Plugin
objects are predefined JavaScript objects that you access through the navigator.plugins
array.
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/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 |
Description
|
|
Number of elements in the plug-in's array of
| |
---|
watch
and unwatch
methods from Object
.
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 |
MimeType
, document.embeds
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.
Plugin
.
MimeType
objects. Last Updated: 05/28/99 12:00:11