Thursday, October 22, 2009

Section 25.204. MimeType: represents a MIME datatype










25.204. MimeType: represents a MIME datatype


JavaScript 1.1; not supported by IE: Object MimeType







25.204.1. Synopsis



navigator.mimeTypes[i]
navigator.mimeTypes["type"]
navigator.mimeTypes.length





25.204.2. Properties




description


A read-only string that provides a human-readable description (in English) of the data type described by the MimeType.




enabledPlugin


A read-only reference to a Plugin object that represents the installed and enabled plug-in that handles the specified MIME type. If the MIME type is not handled by any plug-ins
(for example, if it's handled directly by the browser), the value of this property is null. This property is also null when a plug-in exists but has been disabled.




suffixes


A read-only string that contains a comma-separated list of filename suffixes (not including the "." character) that are commonly used with files of the specified MIME type. For example, the suffixes for the "text/html" MIME type are "html, htm".




type


A read-only string that specifies the name of the MIME type. This is a unique string such as "text/html" or "image/jpeg" that distinguishes the MIME type from all others. It describes the general type of data and the data format used. The value of the type property can also be used as an index to access the elements of the navigator.mimeTypes[] array.





25.204.3. Description


The MimeType object


represents a MIME type (i.e., a data format) supported by a web browser. The format may be supported directly by the browser, or through an external helper application or a plug-in for embedded data. MimeType objects are members of the mimeTypes[] array of the Navigator object. In IE, the mimeTypes[] array is always empty, and there is no equivalent of this functionality.




25.204.4. Usage


The navigator.mimeTypes[] array may be indexed numerically or with the name of the desired MIME type (which is the value of the type property). To check which MIME types are supported by a browser, you can loop through each element in the array numerically. Or, if you just want to check whether a specific type is supported, you can write code like the following:



var show_movie = (navigator.mimeTypes["video/mpeg"] != null);





25.204.5. See Also


Navigator, Plugin













No comments: