# The “name” attribute is never allowed on the “embed” element.

> Canonical HTML version: https://rocketvalidator.com/html-validation/the-name-attribute-is-never-allowed-on-the-embed-element
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `<embed>` element has no `name` attribute in HTML5, so identify it with `id` instead.

Old plugin markup, especially Flash movies wrapped in `<object>` and `<embed>`, often gave the embed a `name` so scripts could reach it through `document.embeds["movie"]` or `document["movie"]`. The HTML standard lists `name` on `<embed>` as obsolete. The validator reports this message together with a second one that calls the attribute obsolete and suggests `id`. Removing `name` clears both.

An `id` does the same job. `document.getElementById("movie")` returns the element, and `document.embeds["movie"]` also finds it by its `id`. A script that used the `document["movie"]` shortcut needs to switch to `getElementById`, because that shortcut does not pick up an `<embed>` by `id`. If no script or CSS refers to the name, you can delete the attribute without adding an `id`.

## Invalid example

```html
<embed src="intro.mp4" type="video/mp4" name="intro" width="640" height="360">
```

## Valid example

```html
<embed src="intro.mp4" type="video/mp4" id="intro" width="640" height="360">
```
