HTML allowfullscreen Attribute

Definition
Definition and Usage
The allowfullscreen boolean attribute on <iframe> is the legacy way to permit the embedded document to enter fullscreen.
New pages should prefer allow="fullscreen". During migration, setting both is common so older and newer engines agree.
Legacy but still seen.Many tutorials and CMS embeds still emit allowfullscreen; browsers continue to honor it.
Prefer allow for new code.Permissions Policy via allow is the modern, extensible approach for fullscreen and other features.
Syntax
HTML Syntax
<iframe allowfullscreen >
Boolean attribute. Presence allows fullscreen attempts from the iframe (subject to browser rules).
Values
Attribute Values
| Value | Description | Try it |
|---|
(boolean) | Present = allow fullscreen (legacy) | Try it |
Try it
Live Preview
Toggle allowfullscreen on a demo iframe (pair with allow="fullscreen" in production).
Code
HTML Examples
Example 1 — Classic allowfullscreen Embed
The historical pattern for video embeds.
<iframe
src="https://example.com/player"
title="Player"
width="560" height="315"
allowfullscreen>
</iframe>
Legacy allowfullscreen boolean on iframe.
How It Works
- Add allowfullscreen as a boolean attribute.
- Set a descriptive title.
- Prefer adding allow="fullscreen" as well.
- Test fullscreen in the target browsers.
Example 2 — allowfullscreen + allow
Migration-friendly pattern used by many embeds.
<iframe
src="https://example.com/player"
title="Player"
width="560" height="315"
allow="fullscreen"
allowfullscreen>
</iframe>
Both allow="fullscreen" and allowfullscreen.
How It Works
- allow covers modern policy.
- allowfullscreen covers legacy expectations.
- Harmless to set both for fullscreen-only needs.
- Add other allow features only when required.
Example 3 — Modern allow Alone
New pages can rely on allow without the legacy flag.
<iframe
src="https://example.com/player"
title="Player"
width="560" height="315"
allow="fullscreen; picture-in-picture"
loading="lazy">
</iframe>
Modern: allow="fullscreen; picture-in-picture" without allowfullscreen.
How It Works
- List features in allow.
- Skip allowfullscreen if your audience is modern-only.
- Keep loading lazy when appropriate.
- See the allow tutorial for more features.
Edge Cases & Pitfalls
Fullscreen still requires a user gesture and a capable embed document.
gestureUser gesture
Browsers typically require a click/tap before entering fullscreen.
sandboxsandbox can block
Missing allow-scripts / policy can prevent fullscreen APIs.
legacyBoolean quirks
Presence matters; do not rely on allowfullscreen="false".
migrateMigrate to allow
Document allow="fullscreen" as the long-term source of truth.
Compatibility
Browser Support
allowfullscreen is an HTML attribute for browsers. It is not a Node.js, Deno, or Bun API.
✓ Legacy · Widely available
allowfullscreen
Universally recognized on iframe; prefer allow="fullscreen" for new Permissions Policy work.
98% Global support (approx.)
Google Chrome Yes
Full support
Mozilla Firefox Yes
Full support
Apple Safari Yes
Full support
Microsoft Edge Yes
Full support
Opera Yes
Full support
Samsung Internet Yes
Full support
Internet Explorer No support
Not supportedallowfullscreen Widely supported
Bottom line: Keep allowfullscreen for compatibility; add allow="fullscreen" on new embeds.
Remember
Key Takeaways
Role: legacy fullscreen permission for iframes.
Boolean: presence enables the intent.
Modern: prefer allow="fullscreen".
Migration: setting both is fine.
One line: allowfullscreen is the legacy fullscreen switch — pair it with allow.
Frequently Asked Questions
It is a legacy boolean on iframe that permits the embedded page to request fullscreen.
Yes for new code — use allow="fullscreen". You can keep allowfullscreen for compatibility.
Yes. Presence means allowed; omit it when you do not want the legacy flag.
Sandbox restrictions can still prevent fullscreen; configure both carefully.
Usually yes — fullscreen typically requires a user gesture inside the embed.
It is legacy but still widely supported. Prefer allow for new Permissions Policy features.
CODETOFUN NEWS
Stay Ahead in Tech
Get the latest IT news, programming updates, and technology trends directly on your phone.
About the author
Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
8 people found this page helpful