You are here: Reference > JavaScript > client-side > browser > objects > mimeType

mimeType object

Browser support:
Represents a supported MIME type.
If you need information about the plug-in that is set to handle the data of a MIME type, use the enabledPlugin property of the mimeType object.

Syntax:

Methods that return the object:
mimeTypes.item (index)
plugin.item (indexOfMime)
mimeTypes.namedItem (name)
plugin.namedItem (nameOfMime)
The base interface, through which you can add new functionalities to the mimeType object, is the MimeType interface.

Possible members:

Properties:
description
Returns a long description of the current MIME type.
enabledPlugin
Returns a plugin object that contains information about the plug-in that is set to handle the data of the current MIME type.
suffixes
Returns a string value that contains a comma separated list of possible file extensions for the current MIME type.
type
Returns the name of the current MIME type.

Example HTML code 1:

This example illustrates the use of the mimeTypes collection and the mimeType object:
<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? yes no

External links:

User Contributed Comments

Post Content

Post Content