HTML Guides for allowfullscreen
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
The allowfullscreen attribute on an iframe element is a boolean attribute and should not be assigned a value like "1".
Boolean attributes in HTML don't need a value. Their mere presence on an element means "true," and their absence means "false." When you write allowfullscreen="1", the W3C validator flags it because "1" is not a valid value for a boolean attribute.
According to the HTML specification, a boolean attribute can only have three valid forms: the attribute name alone (allowfullscreen), an empty string (allowfullscreen=""), or the attribute's own name as the value (allowfullscreen="allowfullscreen"). Any other value, including "1", "true", or "yes", is technically invalid.
Invalid Example
<iframe
src="https://www.example.com/video"
allowfullscreen="1">
</iframe>
Valid Example
<iframe
src="https://www.example.com/video"
allowfullscreen>
</iframe>
In HTML, boolean attributes like allowfullscreen, disabled, readonly, and hidden work differently from what many developers expect. Their presence alone on an element means "true," and their absence means "false." The only valid values for a boolean attribute are the empty string ("") or the attribute's own name (e.g., allowfullscreen="allowfullscreen"). Setting a boolean attribute to "true" is not valid HTML according to the WHATWG HTML living standard, even though browsers will typically still interpret it as enabled.
This matters for several reasons. First, it violates the HTML specification and will produce a W3C validation error. Second, it can create confusion for other developers who may assume that setting the attribute to "false" would disable it — but that's not how boolean attributes work. Setting allowfullscreen="false" would still enable fullscreen because the attribute is present. Keeping your markup valid and semantically correct avoids these misunderstandings and ensures forward compatibility with browsers and tooling.
It's also worth noting that allowfullscreen is now considered a legacy attribute. The modern approach is to use the allow attribute with the "fullscreen" permission token, which is part of the broader Permissions Policy mechanism. The allow attribute gives you fine-grained control over multiple features in a single attribute.
Examples
Incorrect: boolean attribute set to "true"
This triggers the validation error because "true" is not a valid value for a boolean attribute.
<iframesrc="https://example.com"allowfullscreen="true"></iframe>
Correct: boolean attribute with no value
Simply include the attribute name without any value assignment.
<iframesrc="https://example.com"allowfullscreen></iframe>
Also correct: boolean attribute with an empty string
The empty string is a valid value for any boolean attribute.
<iframesrc="https://example.com"allowfullscreen=""></iframe>
Also correct: boolean attribute set to its own name
Per the spec, a boolean attribute can be set to a case-insensitive match of its own name.
<iframesrc="https://example.com"allowfullscreen="allowfullscreen"></iframe>
Recommended: using the modern allow attribute
The allow attribute is the preferred approach going forward. It replaces allowfullscreen and can also control other permissions like camera, microphone, and more.
<iframesrc="https://example.com"allow="fullscreen"></iframe>
You can combine multiple permissions in a single allow attribute:
<iframesrc="https://example.com"allow="fullscreen; camera; microphone"></iframe>
Common mistake: trying to disable with "false"
Be aware that the following does not disable fullscreen — the attribute is still present, so fullscreen is still allowed. This would also produce a validation error.
<!-- This does NOT disable fullscreen — and is invalid HTML -->
<iframesrc="https://example.com"allowfullscreen="false"></iframe>
To disable fullscreen, simply omit the attribute entirely:
<iframesrc="https://example.com"></iframe>
The allowfullscreen attribute on an <iframe> is a boolean attribute and does not accept a value like "yes".
Boolean attributes in HTML work by their presence or absence alone. When a boolean attribute is present on an element, it means "true." When it is absent, it means "false." Valid ways to write a boolean attribute are: the attribute name with no value, an empty string value (""), or the attribute name itself as the value. Assigning "yes", "true", or any other string is invalid.
This applies to all boolean attributes in HTML, such as disabled, checked, autoplay, muted, and allowfullscreen.
Invalid example
<iframe
src="https://example.com/video"
allowfullscreen="yes">
</iframe>
Valid example
Any of these three forms is valid:
<!-- Attribute name only (most common) -->
<iframe
src="https://example.com/video"
allowfullscreen>
</iframe>
<!-- Empty string value -->
<iframe
src="https://example.com/video"
allowfullscreen="">
</iframe>
<!-- Attribute name as the value -->
<iframe
src="https://example.com/video"
allowfullscreen="allowfullscreen">
</iframe>
The first form, with just allowfullscreen and no value, is the most widely used and the most readable.
Validate at scale.
Ship accessible websites, faster.
Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.
Pro Trial
Full Pro access. Cancel anytime.
Start Pro Trial →Join teams across 40+ countries