Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.arcetri.astro.it/irlab/doc/library/javascript/clientreference/mimetype.htm
Дата изменения: Thu Oct 7 13:13:37 1999 Дата индексирования: Sat Dec 22 14:35:32 2007 Кодировка: Поисковые слова: van allen |
MimeType
objects yourself. These objects are predefined JavaScript objects that you access through the mimeTypes
array of the navigator
or Plugin
object:
navigator.mimeTypes[index]where
index
is either an integer representing a MIME type supported by the client or a string containing the type of a MimeType
object (from the MimeType.type
property).
MimeType
object is an element in a mimeTypes
array. The mimeTypes
array is a property of both navigator
and Plugin
objects. For example, the following table summarizes the values for displaying JPEG images:
Expression |
Value
|
|
|
| |
---|
Property |
Description
|
Reference to the
|
The name of the MIME type, for example |
---|
watch
and unwatch
methods from Object
.
type
, description
, suffixes
, and enabledPlugin
properties for each MimeType
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>type",
"<TH ALIGN=left>description",
"<TH ALIGN=left>suffixes",
"<TH ALIGN=left>enabledPlugin.name</TR>")
for (i=0; i < navigator.mimeTypes.length; i++) {
document.writeln("<TR VALIGN=TOP><TD>",i,
"<TD>",navigator.mimeTypes[i].type,
"<TD>",navigator.mimeTypes[i].description,
"<TD>",navigator.mimeTypes[i].suffixes)
if (navigator.mimeTypes[i].enabledPlugin==null) {
document.writeln(
"<TD>None",
"</TR>")
} else {
document.writeln(
"<TD>",navigator.mimeTypes[i].enabledPlugin.name,
"</TR>")
}
}
document.writeln("</TABLE>")
i | type | description | suffixes |
enabledPlugin.name
|
|
|
|
|
|
| |
---|
navigator
, navigator.mimeTypes
, Plugin
Plugin
object for the plug-in that is configured for the specified MIME type If the MIME type does not have a plug-in configured, enabledPlugin
is null. enabledPlugin
property to determine which plug-in is configured for a specific MIME type. Each plug-in may support multiple MIME types, and each MIME type could potentially be supported by multiple plug-ins. However, only one plug-in can be configured for a MIME type. (On Macintosh and Unix, the user can configure the handler for each MIME type; on Windows, the handler is determined at browser start-up time.)
The enabledPlugin
property is a reference to a Plugin
object that represents the plug-in that is configured for the specified MIME type.
You might need to know which plug-in is configured for a MIME type, for example, to dynamically emit an EMBED
tag on the page if the user has a plug-in configured for the MIME type.
// Can we display Shockwave movies?
mimetype = navigator.mimeTypes["application/x-director"]
if (mimetype) {
// Yes, so can we display with a plug-in?
plugin = mimetype.enabledPlugin
if (plugin)
// Yes, so show the data in-line
document.writeln("Here\'s a movie: <EMBED SRC=mymovie.dir HEIGHT=100 WIDTH=100>")
else
// No, so provide a link to the data
document.writeln("<A HREF='mymovie.dir'>Click here</A> to see a movie.")
} else {
// No, so tell them so
document.writeln("Sorry, can't show you this cool movie.")
}
suffixes
property is a string consisting of each valid suffix (typically three letters long) separated by commas. For example, the suffixes for the "audio/x-midi"
MIME type are "mid, midi"
.
"video/mpeg"
or "audio/x-wav"
. MimeType
Last Updated: 05/28/99 11:59:58