JavaScript Navigator mimeTypes Property

Beginner
5 min read
Updated: Nov 2026
5 examples
Property

Definition

navigator.mimeTypes is a read-only Navigator property that returns a MimeTypeArray (MDN). Modern engines hard-code the list: either application/pdf and text/pdf (inline PDF supported) or an empty list.

Read the notes below before you rely on this property. Prefer feature detection when support is limited.

Syntax

Use navigator.mimeTypes. Start with this line.

JavaScript
navigator.mimeTypes
CallWhat it does
navigator.mimeTypesPrimary signature.

Built into the browser. Read navigator.mimeTypes on Navigator — no import required.

Library declarations
JavaScript
navigator.mimeTypes

Parameters

This member has no parameters beyond those shown in the signature.

Return Value

Return ValueDescription
*The current value of navigator.mimeTypes.

JavaScript Examples

Example 1 — Read length

See how many MIME types this browser reports.

JavaScript
const types = navigator.mimeTypes;
console.log("length: " + types.length);
console.log("type: " + typeof types);
Try It Yourself

How It Works

  1. Read the property. Returns a MimeTypeArray, not a plain array.
  2. Check length. Modern browsers: 0 or 2.
  3. Expect hard-coding. Not a full plugin inventory anymore.
  4. Keep it read-only. You inspect; you do not assign.

Example 2 — Check application/pdf (MDN)

Use the in operator to see if the PDF MIME type is listed.

JavaScript
if ("application/pdf" in navigator.mimeTypes) {
  console.log("PDF MIME type listed (inline PDF likely)");
} else {
  console.log("application/pdf not in mimeTypes");
}
Try It Yourself

How It Works

  1. Use in. MDN’s recommended named-property check.
  2. text/pdf matches. Current browsers expose both or neither.
  3. Empty list means no. Spec returns empty when inline PDF is off.
  4. Prefer pdfViewerEnabled for products. Safer Boolean for UI.

Example 3 — description + suffixes

Read the hard-coded PDF plugin description and file suffixes (MDN).

JavaScript
if ("application/pdf" in navigator.mimeTypes) {
  const { description, suffixes } =
    navigator.mimeTypes["application/pdf"];
  console.log("Description: " + description + ", Suffix: " + suffixes);
} else {
  console.log("No PDF MimeType entry");
}
Try It Yourself

How It Works

  1. Guard with in. Avoid reading a missing named entry.
  2. Destructure fields. description and suffixes are strings.
  3. Expect hard-coded values. MDN: “Portable Document Format” and “pdf”.
  4. Demo-only detail. You do not need these to detect PDF viewing.

Example 4 — vs pdfViewerEnabled

Compare the legacy MIME check with the modern Boolean API.

JavaScript
const hasPdfMime = "application/pdf" in navigator.mimeTypes;
const pdfEnabled = Boolean(navigator.pdfViewerEnabled);

console.log("application/pdf in mimeTypes: " + hasPdfMime);
console.log("pdfViewerEnabled: " + pdfEnabled);
console.log("Prefer pdfViewerEnabled for new PDF UI decisions");
Try It Yourself

How It Works

  1. Legacy signal. MIME presence approximates inline PDF on modern engines.
  2. Modern signal. pdfViewerEnabled is the dedicated Boolean.
  3. Compare both. Helps when reading older codebases.
  4. Ship the Boolean. MDN: do not infer PDF support from mimeTypes.

Example 5 — List Entries with item()

Walk the array-like list by index (length may be 0 or 2 today).

JavaScript
const types = navigator.mimeTypes;
const lines = ["length: " + types.length];

for (let i = 0; i < types.length; i++) {
  const mt = types.item(i);
  lines.push((i + 1) + ") " + mt.type);
}

console.log(lines.join("\n"));
Try It Yourself

How It Works

  1. Use item(i). Classic MimeTypeArray accessor (or types[i]).
  2. Read type. The MIME string for that entry.
  3. Do not rely on for…in. Named properties are not enumerable on modern browsers.
  4. Expect a short list. Legacy “many plugins” lists are gone in current specs.

Browser Support

navigator.mimeTypes is Baseline Widely available (MDN, since about July 2015). The MimeTypeArray interface is Deprecated; modern engines return a hard-coded PDF list or empty.

✓ Baseline · Widely available

Navigator.mimeTypes

Supported widely for years. Treat contents as hard-coded PDF metadata (or empty), and prefer pdfViewerEnabled for new checks.

98% Property availability
Google Chrome mimeTypes · hard-coded PDF / empty
Full support
Microsoft Edge mimeTypes · Chromium
Full support
Apple Safari mimeTypes · modern versions
Full support
Mozilla Firefox mimeTypes · modern versions
Full support
Opera mimeTypes · modern versions
Full support
Internet Explorer Legacy plugin MIME lists
Legacy support
navigator.mimeTypes Excellent

Bottom line: Safe to read for learning and legacy code. For product PDF decisions, use navigator.pdfViewerEnabled.

Frequently Asked Questions

A read-only MimeTypeArray of MimeType objects. On modern browsers the list is hard-coded: application/pdf and text/pdf when PDFs can display inline, or an empty list (MDN).
The Navigator.mimeTypes property is Baseline Widely available (since about July 2015) and not labeled Experimental or Non-standard on MDN. The MimeTypeArray interface is Deprecated — prefer navigator.pdfViewerEnabled for new PDF checks.
MDN pattern: if ("application/pdf" in navigator.mimeTypes). Checking text/pdf is equivalent on current browsers — both are present or both are absent.
For new code, use navigator.pdfViewerEnabled. MDN says do not infer inline PDF support from mimeTypes alone.
On the PDF MimeType entry they are hard-coded to “Portable Document Format” and “pdf”. Useful for demos; not required to detect PDF viewing.
No. It is read-only. You inspect the MimeTypeArray; you cannot assign a new list to navigator.mimeTypes.

Next: onLine

Learn how navigator.onLine reports a simple online/offline Boolean.

onLine tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful