JavaScript Navigator mimeTypes Property

Beginner
⏱️ 9 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline

What You’ll Learn

navigator.mimeTypes returns a MimeTypeArray of MIME types the browser reports. On modern engines that usually means hard-coded PDF types — or an empty list. Learn the MDN PDF check, description / suffixes, why pdfViewerEnabled is preferred, five examples, and try-it labs.

01

Kind

Read-only property

02

Returns

MimeTypeArray

03

Baseline

Widely available

04

Modern list

PDF or empty

05

Check

"application/pdf" in …

06

Prefer

pdfViewerEnabled

Introduction

Years ago, browsers exposed many plugin MIME types through navigator.mimeTypes (Flash, PDF plugins, and more). That made fingerprinting easy and was inconsistent.

Today the specification hard-codes the returned set. If the browser can display PDF files inline, you get application/pdf and text/pdf. Otherwise you get an empty list. MDN recommends using navigator.pdfViewerEnabled when you only need that PDF answer — do not infer it solely from mimeTypes in new code.

💡
Learn it, prefer the modern flag

This tutorial teaches mimeTypes for interviews and legacy code. For new PDF-inline detection, use navigator.pdfViewerEnabled.

Understanding the mimeTypes Property

Think of it as a (now simplified) catalog of “file types this browser claims to handle via the legacy plugin model.”

  • Value — a MimeTypeArray with length, item(index), and namedItem(name).
  • Modern contents — PDF pair or empty (hard-coded).
  • PDF entry fields — description "Portable Document Format", suffixes "pdf".
  • Named accessnavigator.mimeTypes["application/pdf"] or the in operator.
  • Baseline — Widely available (MDN, since about July 2015).

📝 Syntax

General form of the property:

JavaScript
navigator.mimeTypes

Value

  • A MimeTypeArray of MimeType objects (or empty when PDFs are not inline-viewable).

Common patterns

JavaScript
// MDN: test inline PDF via mimeTypes
if ("application/pdf" in navigator.mimeTypes) {
  const { description, suffixes } = navigator.mimeTypes["application/pdf"];
  console.log("Description: " + description + ", Suffix: " + suffixes);
}

// Preferred modern check for PDF viewing:
console.log("pdfViewerEnabled:", navigator.pdfViewerEnabled);

⚡ Quick Reference

GoalCode
Get the arraynavigator.mimeTypes
Count entriesnavigator.mimeTypes.length
PDF present?"application/pdf" in navigator.mimeTypes
Read PDF MimeTypenavigator.mimeTypes["application/pdf"]
Prefer for PDF UInavigator.pdfViewerEnabled
Status (MDN)Baseline Widely available

🔍 At a Glance

Four facts to remember about navigator.mimeTypes.

Returns
MimeTypeArray

List / empty

Baseline
widely

Since ~Jul 2015

Modern
PDF pair

Or empty

Prefer
pdfViewerEnabled

For PDF checks

📋 mimeTypes vs pdfViewerEnabled

mimeTypespdfViewerEnabled
TypeMimeTypeArrayBoolean
AnswersReported MIME entries (often PDF)Can the browser show PDFs inline?
MDN tipDo not infer PDF viewing from this aloneUse this for inline PDF support
Best forLegacy / learning the PDF pairNew feature detection

Examples Gallery

Examples follow MDN navigator.mimeTypes patterns. Prefer Try It Yourself — modern browsers often show two PDF entries or zero.

📚 Getting Started

Inspect the array length and run the MDN PDF membership check.

Example 1 — Read Length

Log how many MIME type entries the browser reports.

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

How It Works

Expect 0 or 2 on current browsers — not a long plugin list.

Example 2 — PDF Membership Check (MDN)

Test whether application/pdf is listed in mimeTypes.

JavaScript
if ("application/pdf" in navigator.mimeTypes) {
  console.log("Inline PDF MIME types are listed");
} else {
  console.log("No application/pdf entry (empty list)");
}
Try It Yourself

How It Works

MDN notes text/pdf behaves the same on current browsers — both present or both absent.

📈 Practical Patterns

Read hard-coded PDF details, compare with pdfViewerEnabled, and summarize safely.

Example 3 — Description & Suffixes (MDN)

When PDF is listed, read the hard-coded description and file suffix.

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

How It Works

On modern browsers these strings are hard-coded — useful for demos, not for discovering new plugins.

Example 4 — Compare with pdfViewerEnabled

See how the MIME list and the dedicated PDF flag relate on this browser.

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

They usually agree, but MDN’s guidance is clear: use pdfViewerEnabled when the question is “can we show PDFs inline?”

Example 5 — MimeTypes Summary Helper

Return a small object with length, PDF flags, and optional description.

JavaScript
function mimeTypesSummary() {
  const list = navigator.mimeTypes;
  const hasPdf = "application/pdf" in list;
  const entry = hasPdf ? list["application/pdf"] : null;
  return {
    length: list.length,
    hasApplicationPdf: hasPdf,
    hasTextPdf: "text/pdf" in list,
    pdfViewerEnabled: Boolean(navigator.pdfViewerEnabled),
    description: entry ? entry.description : null,
    suffixes: entry ? entry.suffixes : null
  };
}

console.log(JSON.stringify(mimeTypesSummary(), null, 2));
Try It Yourself

How It Works

Handy for a debug panel — keep production PDF decisions on pdfViewerEnabled.

🚀 Common Use Cases

  • Legacy PDF detection — understand older code that checks "application/pdf" in mimeTypes.
  • Interview / learning — explain hard-coded PDF vs empty list behavior.
  • Debug panels — show length and PDF MimeType fields beside pdfViewerEnabled.
  • Migration — replace mimeTypes-based PDF checks with pdfViewerEnabled.
  • History of plugins — contrast with old long plugin MIME lists (no longer exposed).

🧠 How navigator.mimeTypes Works

1

Browser decides PDF inline support

Can this engine display PDF files inside a tab?

Capability
2

Spec hard-codes the list

PDF pair if yes; empty MimeTypeArray if no.

Hard-code
3

You query with in / indexed access

Check application/pdf or read description/suffixes.

Query
4

Prefer pdfViewerEnabled for new UI

MDN: do not infer PDF viewing from mimeTypes alone.

📝 Notes

  • Baseline Widely available (MDN, since about July 2015).
  • Not Deprecated, Experimental, or Non-standard on MDN’s property page — no status banner required.
  • Modern list is hard-coded: PDF types or empty — not a full plugin inventory.
  • Prefer navigator.pdfViewerEnabled for inline PDF feature detection.
  • Related: mediaSession, mediaDevices, JavaScript hub.

Universal Browser Support

navigator.mimeTypes is Baseline Widely available (MDN: since about July 2015). Modern engines return a hard-coded PDF pair or an empty list. Use pdfViewerEnabled for new PDF-inline checks.

Baseline · Widely available

Navigator.mimeTypes

MimeTypeArray for reported MIME types — today mainly application/pdf and text/pdf, or empty.

Universal Widely available
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
mimeTypes Excellent

Bottom line: Learn mimeTypes for PDF membership checks and legacy code. Prefer pdfViewerEnabled when building new PDF UI.

Conclusion

navigator.mimeTypes returns a MimeTypeArray. On modern browsers that usually means hard-coded application/pdf / text/pdf entries — or none. Use the MDN in check to explore it, and rely on navigator.pdfViewerEnabled for new inline-PDF decisions.

Continue with onLine, Window methods, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Use pdfViewerEnabled for new PDF-inline detection
  • Expect length 0 or 2 on current browsers
  • Treat description/suffixes as hard-coded for PDF
  • Feature-detect before reading named entries
  • Document why legacy code still reads mimeTypes

❌ Don’t

  • Expect a rich plugin MIME inventory anymore
  • Infer PDF viewing only from mimeTypes in new apps
  • Use it as a unique browser fingerprint
  • Assume every browser returns custom suffixes
  • Confuse it with HTTP Content-Type negotiation

Key Takeaways

Knowledge Unlocked

Five things to remember about mimeTypes

Baseline MimeTypeArray — modern PDF pair or empty; prefer pdfViewerEnabled.

5
Core concepts
📑 02

Modern

PDF or empty

Hard-coded
🔍 03

Check

application/pdf

in
📖 04

Prefer

pdfViewerEnabled

Modern
05

Status

Baseline

Wide

❓ Frequently Asked Questions

It is a read-only Navigator property that returns a MimeTypeArray of MimeType objects the browser reports as recognized. On modern browsers the list is hard-coded: either application/pdf and text/pdf (when PDFs can display inline) or an empty list.
MDN marks navigator.mimeTypes Baseline Widely available and does not label it Deprecated, Experimental, or Non-standard on the property page. Still, prefer Navigator.pdfViewerEnabled when you only need to know if PDFs open inline.
A common MDN pattern is if ("application/pdf" in navigator.mimeTypes). Checking text/pdf is equivalent on current browsers — both are present or both are absent.
Recent specifications hard-code the returned MIME types for privacy and consistency. Legacy browsers sometimes returned many plugin MIME types; modern engines mainly expose the PDF pair or nothing.
On the PDF MimeType entry they are hard-coded to “Portable Document Format” and “pdf”. You can read them, but you do not need them to detect PDF viewing.
No. It is read-only. You inspect the MimeTypeArray; you cannot assign a new list to navigator.mimeTypes.
Did you know?

MDN’s sample destructures { description, suffixes } from navigator.mimeTypes["application/pdf"] — and notes you do not actually need those strings on current browsers because they are hard-coded to PDF / Portable Document Format.

Learn onLine Next

Boolean online/offline status and window network events.

onLine →

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.

8 people found this page helpful