| Availability: |
| |||||
| JavaScript syntax: | - | myMimeTypeArray = navigator.mimeTypes | ||||
| Object properties: | length | |||||
On MSIE, this array contains an element for each supported MimeType object that the browser can respond to.
Likewise on Netscape, a collection of somewhat different MimeType objects are available.
MSIE prior to version 5.0 does not support this facility and returns the undefined value even though it has a place holder for the property.
Note that Netscape 4.7 on Macintosh exhibits some careless MimeType instantiation with at least two of the items in this array.
Item 50 does not exhibit an associative value because the type property for that MimeType is undefined. There is no apparent fix because the type property of a MimeType object is read only although there is no error generated when trying to assign a new value to it. The proper type value for this item should be "application.gzip".
Item 64 has a similar problem but just presents a null string rather than its index. This MimeType represents UU encoded files. It doesn't show up in the list of applications that map to file types in the Netscape preferences.
This problem may be extant on other platforms although it is possible that the problems may be related to your user preference settings and the indices that have problems may not be the same number or MimeType values.
The implications are that GZIP and UUencoded files are handled internally by the browser and therefore although it creates MimeType objects, they may not be derived from the preferences settings although changing your preferences may relocate these objects to different positions in the collection.
Build an enumerator to examine the MimeType objects in the collection. You'll see a fragment of script that would do this in the example. There is no real fix for this other than to build some conditional check into any enumeration or iterative loop that examines the MimeTypes array.
Note that Netscape 6.0 does not enumerate this collection properly and the example does not yield the correct result.
// Inline this script fragment to display all mime types
// supported by your browser (except for NNav 6.0 which exhibits
// a strange bug.
for(myProp in navigator.mimeTypes)
{
document.write(myProp);
document.write("<BR>");
}| Property | JavaScript | JScript | N | IE | Opera | NES | ECMA | DOM | CSS | HTML | Notes |
|---|---|---|---|---|---|---|---|---|---|---|---|
| length | 1.1 ![]() | 3.0 ![]() | 3.0 ![]() | 4.0 ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ReadOnly. |
| Prev | Home | Next |
| MimeType.type | Up | MimeTypeArray.length |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||