HTML DOM Document embeds property

Definition and usage

embeds The property returns a collection of all <embed> elements in the document.

embeds The property is read-only.

Warning

Most browsers no longer support embedded applets or plugins.

No browser supports embedded ActiveX controls anymore.

Shockwave Flash is also disabled in modern browsers.

Recommendation

To embed images, use <img> tag.

To embed HTML, use <iframe> tag.

To embed video or audio, use <video> or <audio> tag.

See also:

HTML DOM Embed Object

HTML <embed> Tag

Example

Number of <embed> elements in the document:

let num = document.embeds.length;

Try it yourself

Syntax

document.embeds

Property

Property Description
length The number of <embed> elements in the collection.

Method

Method Description
[index]

Returns the element with the specified index (starting from 0).

Returns null if the index is out of range.

item(index)

Returns the element with the specified index (starting from 0).

Returns null if the index is out of range.

namedItem(id)

Returns an element with the specified id element.

If id Returns null if it does not exist.

Return value

Type Description
Object

HTMLCollection object.

All <embed> elements in the document.

is sorted in the order they appear in the source code.

Browser support

document.embeds It is a DOM Level 3 (2004) feature.

All browsers support it:

Chrome IE Edge Firefox Safari Opera
Chrome IE Edge Firefox Safari Opera
Support 9-11 Support Support Support Support