mimeTypes collection
Represents a collection of all supported MIME types.
Internet Explorer supports the mimeTypes collection but it is always empty and there is no way to get the supported MIME types in this the browser.
Syntax:
Properties that reference the object:
| object.mimeTypes |
Related objects:
|
The base interface, through which you can add new functionalities to the mimeTypes collection, is the MimeTypeArray interface.
Possible members:
Properties:
Returns an integer that specifies the number of objects in the current collection.
This property is read-only. |
Methods:
[nameOrIndex] |
Returns an object from the current collection by name or index.
Parameters:
Return value:
Returns an mimeType object.
|
||||||||||||||
item (index) |
Returns an object from the current collection by index.
Parameters:
Return value:
Returns the mimeType object at the specified position.
|
||||||||||||||
namedItem (name) | Returns an object from the current collection by name. |
Example HTML code 1:
This example illustrates the use of the mimeTypes collection:
|
||||
<head> <script type="text/javascript"> function GetMimeTypes () { var message = ""; // Internet Explorer supports the mimeTypes collection, but it is always empty if (navigator.mimeTypes && navigator.mimeTypes.length > 0) { var mimes = navigator.mimeTypes; for (var i=0; i < mimes.length; i++) { message += "<b>" + mimes[i].type + "</b> : " + mimes[i].description + "<br />"; } } else { message = "Your browser does not support this example!"; } var info = document.getElementById ("info"); info.innerHTML = message; } </script> </head> <body onload="GetMimeTypes ()"> Supported MIME types: <div id="info" style="width:500px; height:300px; overflow:auto; background-color:#e0d0d0;"></div> </body> |
||||
|
||||
Did you find this example helpful?
|
External links:
User Contributed Comments