HTML allowfullscreen Attribute

Beginner
6 min read
Updated: Nov 2026
3 examples
Live preview

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.

HTML Syntax

syntax.html
<iframe allowfullscreen >

Boolean attribute. Presence allows fullscreen attempts from the iframe (subject to browser rules).

Attribute Values

ValueDescriptionTry it
(boolean)Present = allow fullscreen (legacy)Try it

Live Preview

Toggle allowfullscreen on a demo iframe (pair with allow="fullscreen" in production).

Modern pages should also set allow="fullscreen".

Result

allowfullscreen present

HTML Examples

Example 1 — Classic allowfullscreen Embed

The historical pattern for video embeds.

HTML
<iframe
  src="https://example.com/player"
  title="Player"
  width="560" height="315"
  allowfullscreen>
</iframe>
Try It Yourself

How It Works

  1. Add allowfullscreen as a boolean attribute.
  2. Set a descriptive title.
  3. Prefer adding allow="fullscreen" as well.
  4. Test fullscreen in the target browsers.

Example 2 — allowfullscreen + allow

Migration-friendly pattern used by many embeds.

HTML
<iframe
  src="https://example.com/player"
  title="Player"
  width="560" height="315"
  allow="fullscreen"
  allowfullscreen>
</iframe>
Try It Yourself

How It Works

  1. allow covers modern policy.
  2. allowfullscreen covers legacy expectations.
  3. Harmless to set both for fullscreen-only needs.
  4. Add other allow features only when required.

Example 3 — Modern allow Alone

New pages can rely on allow without the legacy flag.

HTML
<iframe
  src="https://example.com/player"
  title="Player"
  width="560" height="315"
  allow="fullscreen; picture-in-picture"
  loading="lazy">
</iframe>
Try It Yourself

How It Works

  1. List features in allow.
  2. Skip allowfullscreen if your audience is modern-only.
  3. Keep loading lazy when appropriate.
  4. See the allow tutorial for more features.

Edge Cases & Pitfalls

Fullscreen still requires a user gesture and a capable embed document.

gesture

User gesture

Browsers typically require a click/tap before entering fullscreen.

sandbox

sandbox can block

Missing allow-scripts / policy can prevent fullscreen APIs.

legacy

Boolean quirks

Presence matters; do not rely on allowfullscreen="false".

migrate

Migrate to allow

Document allow="fullscreen" as the long-term source of truth.

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 supported
allowfullscreen Widely supported

Bottom line: Keep allowfullscreen for compatibility; add allow="fullscreen" on new embeds.

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.

Next: alt

Write accessible alternative text for images.

alt tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

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