You are here: Reference > JavaScript > client-side > HTML DOM > properties > mimeType (document, a, img)

mimeType property (document, a, img)

Browser support:
Retrieves the type of the document file or the type of a linked file.
This type is different from the MIME type, it is the description that belongs to the file extension in the current operating system.
If you need the MIME type of the current document, use the contentType property although it is only supported by Firefox.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

String that represents the description of the file extension.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the mimeType property:
    <script type="text/javascript">
        function GetFileDescription () {
            var image = document.getElementById ("image");
            if ('mimeType' in image) {
                alert (image.mimeType);
            } else {
                alert ("Your browser doesn't support the mimeType property.");
    <img id="image" src="picture.gif" />
    <button onclick="GetFileDescription ();">Get the description of the type of the image</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

User Contributed Comments

Post Content

Post Content