HTML allowfullscreen Attribute

The allowfullscreen attribute is commonly used with <iframe> elements to allow embedded content to enter fullscreen mode. Without this attribute, users may not be able to expand videos or other embedded media to fill their entire screen.

Basic Example

<iframe
    src="https://www.youtube.com/embed/dQw4w9WgXcQ"
    width="560"
    height="315"
    allowfullscreen>
</iframe>
What happens?
When a user clicks the fullscreen button in the embedded video player, the browser allows the content to expand to fullscreen mode.

Why Use allowfullscreen?

Common Use Cases

Content Type Uses allowfullscreen?
YouTube Videos Yes
Vimeo Videos Yes
Interactive Maps Sometimes
Embedded Presentations Often

Modern Alternative

Some websites also use the allow attribute alongside allowfullscreen:

<iframe
    src="https://example.com"
    allow="fullscreen"
    allowfullscreen>
</iframe>

Including both attributes can help ensure compatibility with modern browser permission policies and embedded content requirements.

Browser Support

The allowfullscreen attribute is widely supported across modern desktop and mobile browsers, making it a standard choice for embedded media.