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.
<iframe
src="https://www.youtube.com/embed/dQw4w9WgXcQ"
width="560"
height="315"
allowfullscreen>
</iframe>
| Content Type | Uses allowfullscreen? |
|---|---|
| YouTube Videos | Yes |
| Vimeo Videos | Yes |
| Interactive Maps | Sometimes |
| Embedded Presentations | Often |
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.
The allowfullscreen attribute is widely supported across
modern desktop and mobile browsers, making it a standard choice for
embedded media.