Example 1 — Count with plugins.length
Count every <embed> on the page.
const count = document.plugins.length;
console.log("embed count:", count);
if (count === 0) {
console.log("No <embed> elements on this page");
} How It Works
- Read
document.plugins. Live collection of embeds (MDN). - Use
.length. Counts<embed>tags — not installed plugins. - Iframes / objects do not count. Query those separately.
- Guard empty pages before indexing
[0].

