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
Fundamentals
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.
Concept
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 access — navigator.mimeTypes["application/pdf"] or the in operator.
Baseline — Widely available (MDN, since about July 2015).
Foundation
📝 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);
Cheat Sheet
⚡ Quick Reference
Goal
Code
Get the array
navigator.mimeTypes
Count entries
navigator.mimeTypes.length
PDF present?
"application/pdf" in navigator.mimeTypes
Read PDF MimeType
navigator.mimeTypes["application/pdf"]
Prefer for PDF UI
navigator.pdfViewerEnabled
Status (MDN)
Baseline Widely available
Snapshot
🔍 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
Compare
📋 mimeTypes vs pdfViewerEnabled
mimeTypes
pdfViewerEnabled
Type
MimeTypeArray
Boolean
Answers
Reported MIME entries (often PDF)
Can the browser show PDFs inline?
MDN tip
Do not infer PDF viewing from this alone
Use this for inline PDF support
Best for
Legacy / learning the PDF pair
New feature detection
Hands-On
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.
length: 2
type: object
(or length: 0 when inline PDF is not available)
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)");
}
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.
UniversalWidely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
mimeTypesExcellent
Bottom line: Learn mimeTypes for PDF membership checks and legacy code. Prefer pdfViewerEnabled when building new PDF UI.
Wrap Up
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.
Baseline MimeTypeArray — modern PDF pair or empty; prefer pdfViewerEnabled.
5
Core concepts
📄01
Returns
MimeTypeArray
Type
📑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.