JavaScript Document plugins Property

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Baseline Widely available
Instance property

What You’ll Learn

Document.plugins is a read-only instance property that returns a live HTMLCollection of every <embed> element in the document. Learn how it matches document.embeds, how it differs from navigator.plugins, and five examples with try-it labs.

01

Kind

Read-only property

02

Returns

HTMLCollection

03

Matches

<embed> only

04

Same as

document.embeds

05

Not

navigator.plugins

06

Status

Baseline widely

Introduction

The name plugins can be confusing. On Document, it does not list Flash or PDF browser plugins installed on the machine. It lists the <embed> elements currently in the HTML page.

MDN: the plugins read-only property returns an HTMLCollection containing one or more HTMLEmbedElement objects representing the <embed> elements in the current document. For a list of installed plugins, MDN says to use Navigator.plugins instead.

💡
Same list as document.embeds

In modern HTML, document.plugins and document.embeds return the same live collection. Pick either name; many newer tutorials prefer embeds because it matches the tag.

Related Document tutorials: embeds, images, applets, Document constructor.

Understanding Document.plugins

A read-only instance property on Document. Its value is a live HTMLCollection of every <embed> in the document tree.

  • ValueHTMLCollection of HTMLEmbedElement objects (MDN).
  • Read-only — you do not assign a new collection to document.plugins.
  • Live collection — reflects DOM changes when embeds are added or removed.
  • Indexed accessdocument.plugins[i] or item(i).
  • Alias — same collection as document.embeds in modern HTML.
  • Not Navigator — installed plugins live on navigator.plugins (MDN).

📝 Syntax

JavaScript
document.plugins

Value

An HTMLCollection of <embed> elements in the document (MDN).

Common patterns

JavaScript
const count = document.plugins.length;
const first = document.plugins[0];

for (const el of document.plugins) {
  console.log(el.src);
}

// Same collection as embeds:
console.log(document.plugins === document.embeds); // true in modern browsers

CSS-selector alternative

JavaScript
const embeds = document.querySelectorAll("embed");
// Static NodeList — does not auto-update when you add/remove embeds

⚡ Quick Reference

GoalCode / note
All embedsdocument.plugins
Countdocument.plugins.length
First embeddocument.plugins[0]
Read sourcedocument.plugins[0].src
Same collectiondocument.embeds
Installed pluginsnavigator.plugins (not Document)
MDN statusBaseline Widely available (since Jun 2018)

🔍 At a Glance

Four facts about document.plugins.

Type
HTMLCollection

Read-only, live

Contains
embed

HTMLEmbedElement

Alias
embeds

Same list

Status
baseline

Widely available

📋 document.plugins vs navigator.plugins

document.pluginsnavigator.plugins
InterfaceDocumentNavigator
Lists<embed> elements in the pageInstalled browser plugins
Item typeHTMLEmbedElementPlugin descriptors (legacy)
MDN tipPage embedsUse this for installed plugins

Examples Gallery

Examples follow MDN Document: plugins. Use View Output or Try It Yourself for each case.

📚 Getting Started

Count embeds and read each resource URL.

Example 1 — Check document.plugins.length

Count how many <embed> elements exist on the page.

JavaScript
const count = document.plugins.length;
console.log("embed count:", count);

if (count === 0) {
  console.log("No <embed> elements on this page");
}
Try It Yourself

How It Works

length is the number of matching <embed> tags—not the number of installed browser plugins.

Example 2 — Loop and Read src

Inspect each embed’s resource URL.

JavaScript
for (const el of document.plugins) {
  console.log(el.tagName, el.src);
}
Try It Yourself

How It Works

Each item is an HTMLEmbedElement with the usual properties such as src and type.

📈 Alias, Live Updates & Navigator

Prove the embeds alias, watch live updates, and contrast Navigator.

Example 3 — Same Object as document.embeds

Modern browsers expose one shared collection under two names.

JavaScript
console.log(document.plugins === document.embeds);
console.log(document.plugins.length === document.embeds.length);
Try It Yourself

How It Works

If you already know document.embeds, you already know document.plugins.

Example 4 — Live Collection Updates

Adding an embed increases document.plugins.length automatically.

JavaScript
const before = document.plugins.length;
const el = document.createElement("embed");
el.src = "https://example.com/new.pdf";
el.type = "application/pdf";
document.body.appendChild(el);
console.log(before, "→", document.plugins.length);
Try It Yourself

How It Works

Like other Document collections, you do not need to re-query after DOM changes.

Example 5 — Not the Same as navigator.plugins

MDN: use Navigator.plugins for installed plugins—not Document.plugins.

JavaScript
console.log("document.plugins length:", document.plugins.length);
console.log("navigator.plugins length:", navigator.plugins.length);
console.log("Same object?", document.plugins === navigator.plugins);
// false — totally different APIs
Try It Yourself

How It Works

Remember the rule: Document = embeds on the page; Navigator = installed plugins.

🚀 Common Use Cases

  • Inventory embeds — count PDFs or other resources inserted with <embed>.
  • Read legacy scripts — older code often uses document.plugins instead of embeds.
  • Live DOM tools — watch length change as embeds are injected.
  • Avoid wrong API — stop confusing page embeds with navigator.plugins.
  • Teaching collections — compare with document.images and document.forms.
  • Prefer embeds in new code — clearer name when you write fresh tutorials.

🧠 How document.plugins Works

1

Document hosts <embed> tags

Authors place one or more embed elements in the HTML tree.

Markup
2

Browser builds a filtered collection

document.plugins exposes those embeds as a live HTMLCollection.

Collect
3

You read length / index / loops

Scripts inspect src and other embed properties without a manual tree walk.

Access
4

Same list as document.embeds

Use either name; keep navigator.plugins for installed plugins only.

📝 Notes

  • MDN: Baseline Widely available (since June 2018) — no Deprecated / Experimental / Non-standard banner.
  • Value is an HTMLCollection of <embed> / HTMLEmbedElement only.
  • document.embeds returns the same collection in modern HTML.
  • For installed plugins, use navigator.plugins (MDN)—not document.plugins.
  • Related: embeds, images, applets, Document constructor.

Universal Browser Support

Document.plugins is marked Baseline Widely available on MDN (since June 2018). Logos use the shared browser-image-sprite.png sprite from this project.

Baseline · Widely available

Document.plugins

Read-only live HTMLCollection of every embed element — same list as document.embeds.

Universal Widely available
Google Chrome Full support · Desktop & Mobile
Full support
Mozilla Firefox Full support · Desktop & Mobile
Full support
Apple Safari Full support · macOS & iOS
Full support
Microsoft Edge Full support · Chromium
Full support
Opera Full support · Modern versions
Full support
Internet Explorer Supported in legacy IE
Full support
Document.plugins Excellent

Bottom line: Use document.plugins (or document.embeds) to list every embed on a page. Do not confuse it with navigator.plugins for installed browser plugins.

Conclusion

Document.plugins is the live list of every <embed> in a document—the same collection as document.embeds. Use it to count and inspect embeds, and remember that installed browser plugins belong to navigator.plugins instead.

Continue with pointerLockElement, embeds, images, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Treat document.plugins as a list of <embed> elements
  • Prefer document.embeds in new code for clearer naming
  • Use navigator.plugins when you need installed plugins (MDN)
  • Remember the collection is live after DOM changes
  • Use querySelectorAll("embed") for static snapshots or filters

❌ Don’t

  • Expect Flash/PDF installer lists from document.plugins
  • Assume iframe / object / video appear in the collection
  • Confuse Document and Navigator plugin APIs
  • Rely on plugin-based embeds for modern media when video/iframe fit better
  • Cache length across long loops if DOM may change mid-loop

Key Takeaways

Knowledge Unlocked

Five things to remember about document.plugins

Embed elements on the page — not installed browser plugins.

5
Core concepts
📄02

Items

HTMLEmbedElement

<embed>
🔄03

Alias

document.embeds

Same
⚠️04

Not

navigator.plugins

MDN
🔍05

Live

Auto-updates

DOM

❓ Frequently Asked Questions

A read-only HTMLCollection of every <embed> element in the current document (HTMLEmbedElement objects). MDN: one or more HTMLEmbedElement objects representing the embed elements in the document.
No. MDN marks Document.plugins as Baseline Widely available (since June 2018). It is a standard Document collection property.
Yes in modern HTML. Both return the same live HTMLCollection of embed elements on the page.
No. document.plugins lists <embed> elements in the document. navigator.plugins lists installed browser plugins (a different API). MDN tells you to use Navigator.plugins for installed plugins.
Yes. HTMLCollection is live — if you add or remove an <embed>, document.plugins.length and indexed access update automatically.
Either works for the same list. Many tutorials prefer document.embeds because the name matches the HTML tag. Use document.plugins when reading older code that already uses that name.
Did you know?

The word “plugins” stuck from the era when <embed> often loaded NPAPI plugins. Today the property still means “every embed on this page,” even though classic browser plugins are largely gone. That historical name is why MDN warns beginners to use navigator.plugins for installed plugins instead.

Next: pointerLockElement

Learn which element currently owns pointer lock in the document.

pointerLockElement →

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.

6 people found this page helpful