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

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

The validator warns about `name` on a `<frame>` because the `<frame>` element itself is obsolete, and the warning goes away when the frame becomes an `<iframe>`, which accepts `name`.

In a frameset, `name` gives a frame the target name that other documents use to load pages into it. A link with `target="content"` opens its page in the frame named `content`, a form with the same `target` shows its response there, and a script can reach the frame through `window.frames["content"]`. Menus built with frames depend on it: every link in the menu frame points at the frame that holds the content. Browsers still honor these names, which is why the frames keep working.

The validator checks `name` on every element against a short list of elements that define it: `button`, `details`, `fieldset`, `form`, `iframe`, `input`, `map`, `meta`, `object`, `output`, `select`, `slot` and `textarea`. `<frame>` isn't on that list because it's obsolete. The validator reports this check as an informational message rather than an error, so it shows up as a warning, once for each named frame. The errors come from the elements themselves: each `<frame>` gets a message saying it's obsolete, and so does the `<frameset>` around it. Other attributes common on old frames, such as `frameborder`, `scrolling` and `noresize`, get no message on a `<frame>`.

Deleting `name` silences the warning but breaks every link and form that targets the frame, and the obsolete errors stay. Replace the frameset instead. A frame whose content moves into the page itself, such as a menu, no longer needs a name, since nothing loads into it. A frame that becomes an `<iframe>` keeps its `name`, so links with a matching `target` keep loading into it.

## Invalid example

The links in `menu.html` use `target="content"` to open each recipe in the second frame:

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Recipe box</title>
  </head>
  <frameset cols="200,*">
    <frame src="menu.html" name="menu">
    <frame src="welcome.html" name="content">
  </frameset>
</html>
```

## Valid example

The menu moves into the page, and the iframe keeps the name `content`, so the links still load into it:

```html
<!DOCTYPE html>
<html lang="en">
  <head>
    <title>Recipe box</title>
  </head>
  <body>
    <nav>
      <a href="soups.html" target="content">Soups</a>
      <a href="desserts.html" target="content">Desserts</a>
    </nav>
    <iframe src="welcome.html" name="content" title="Recipe"></iframe>
  </body>
</html>
```
