W3cubDocs

/Web APIs

MimeTypeArray

Deprecated: This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

The MimeTypeArray interface returns an array of MimeType instances, each of which contains information about a supported browser plugins. This object is returned by Navigator.mimeTypes.

Note: This interface was an attempt to create an unmodifiable list and only continues to be supported to not break code that's already using it. Modern APIs use types that wrap around ECMAScript array types instead, so you can treat them like ECMAScript arrays, and at the same time impose additional semantics on their usage (such as making their items read-only).

Instance properties

MimeTypeArray.length Deprecated

The number of items in the array.

Instance methods

MimeTypeArray.item() Deprecated

Returns the MimeType object with the specified index.

MimeTypeArray.namedItem() Deprecated

Returns the MimeType object with the specified name.

Example

The following example tests whether a plugin is available for the 'application/pdf' mime type and if so, logs its description.

js

const mimeTypes = navigator.mimeTypes;
const pdf = mimeTypes.namedItem("application/pdf");

if (pdf) {
  console.log(pdf.description);
}

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
MimeTypeArray 1 12 1 4 ≤12.1 1 4.4 18 4 ≤12.1 1 1.0
item
1Before version 59, method parameters were optional
12 1 11 ≤12.1 4
≤37Before version 59, method parameters were optional
18Before version 59, method parameters were optional
4 ≤12.1 3.2
1.0Before Samsung Internet 7.0, method parameters were optional
length 1 12 1 4 ≤12.1 1 4.4 18 4 ≤12.1 1 1.0
namedItem
1Before version 59, method parameters were optional
12 1 11 ≤12.1 4
≤37Before version 59, method parameters were optional
18Before version 59, method parameters were optional
4 ≤12.1 3.2
1.0Before Samsung Internet 7.0, method parameters were optional

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MimeTypeArray