# Bad value X for attribute “loading” on element “iframe”.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-x-for-attribute-loading-on-element-iframe
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `loading` attribute on an `iframe` element accepts only `lazy` or `eager`, so an empty value like `loading=""` or any other word is invalid.

With `eager`, the browser loads the frame right away, which is also what happens when the attribute is missing. With `lazy`, it waits until the frame gets close to the viewport, which saves bandwidth for embeds further down the page. The empty string is not one of these keywords. Browsers treat it as an invalid value and fall back to eager loading, so the attribute does nothing except fail validation. Values such as `true` or `auto` trigger the same error.

An empty `loading=""` usually comes from a template or CMS plugin that prints the attribute even when its lazy-loading option is off. Fix it where the markup is generated: output `loading="lazy"` when you want the frame deferred, and leave the attribute out otherwise.

## Invalid example

```html
<iframe src="https://example.com/embed/map" title="Store location map" loading=""></iframe>
```

## Valid example

Defer the frame until the user scrolls near it:

```html
<iframe src="https://example.com/embed/map" title="Store location map" loading="lazy"></iframe>
```

Or drop the attribute to load it right away:

```html
<iframe src="https://example.com/embed/map" title="Store location map"></iframe>
```
