HTML / Element / Initial coverage

The <iframe> Element

Status: Initial coverage Scope: HTML Living Standard Specification checked: 2026-09-19

Technical Summary

The iframe element represents a separate content navigable inside the parent Document and displays the active Document loaded there. It is not only a visual rectangle: it introduces navigation, Document, Window, origin, and load boundaries.

src identifies a document to load from a URL; srcdoc constructs a document from an attribute value and takes priority when both are present. For external or untrusted content, inspect sandboxing, Permissions Policy, referrer behavior, and the embedded document's accessible name separately.

Definition / Categories

ItemNormative organization
MeaningRepresents the content navigable containing the embedded content
CategoriesFlow content, Phrasing content, Embedded content, Interactive content, and Palpable content
ContextWhere embedded content is expected
Content modelNothing
Main content attributessrc, srcdoc, name, sandbox, allow, allowfullscreen, width, height, referrerpolicy, and loading
DOM interfaceHTMLIFrameElement, including src, srcdoc, name, sandbox, allow, referrerPolicy, loading, contentDocument, and contentWindow

A content navigable is the Web Platform container used to load the iframe's child document. The DOM element visible to the parent and the active Document inside the child navigable are distinct objects.

src, srcdoc, and the initial document

When src is present, its value is parsed as a URL relative to the parent Document and the iframe's content navigable is navigated. When srcdoc is present, the user agent constructs an about:srcdoc Document from it and gives it priority over src.

StateBoundary to inspect
srcdoc presentConstructs a srcdoc document whose URL is treated as about:srcdoc
srcdoc absent, valid srcNavigates the child navigable to the resolved URL
No src on initial insertion or parsing failsThe initial about:blank Document can remain active
Both src and srcdocProcesses srcdoc; src is not used at the same time as the active fallback
<iframe
  title="Generated preview"
  sandbox
  srcdoc="&lt;h1&gt;Preview&lt;/h1&gt;&lt;p&gt;Separate document&lt;/p&gt;">
</iframe>

HTML in the attribute is interpreted in two stages: by the outer HTML parser and then as the srcdoc document. Quotation marks, ampersands, and script-containing strings therefore need an explicit Trusted Types, CSP, and sanitization policy.

Navigation, load, and the DOM interface

When iframe attributes are inserted, changed, or removed, the user agent can run the iframe attributes processing steps and navigate the child navigable. When loading completes, a load event is fired at the iframe. A load event is not evidence that the content is trustworthy, correct, or readable by the parent DOM.

const frame = document.querySelector('#preview');

frame.addEventListener('load', () => {
  console.log(frame.contentWindow);
});

// Whether contentDocument can be read depends on origin and other conditions.

contentDocument and contentWindow are exposed by the DOM interface, but they do not mean that a parent can freely read or write a cross-origin child document. Same-origin policy, sandbox opaque origins, CSP, and COEP are separate boundaries that may need to be evaluated together.

sandbox, origin, and permissions

When the sandbox attribute is present, additional sandboxing restrictions apply to the iframe's content. With an empty sandbox value, scripts, forms, popups, top-level navigation, and other capabilities are restricted. Tokens can selectively re-enable capabilities.

SettingMain boundaryImportant condition
sandboxEnables additional restrictionsEven an empty value enables restrictions
allow-scriptsAllows script executionOther restrictions remain unless separately re-enabled
allow-same-originUses the real origin rather than an opaque originWith scripts and same-origin content, it can provide a path to remove the sandbox
allow-forms and similar tokensRe-enable forms, popups, or top navigation as applicableChoose only the capabilities required by the embedded application

Giving same-origin content both allow-scripts and allow-same-origin can allow the content to remove the sandbox in some situations, so this combination is not a strong isolation design. Separating the origin that serves hostile content is an additional security measure rather than a replacement for careful sandbox configuration.

allow, referrerpolicy, and loading

AttributeRoleDifferent from
allowSpecifies Permissions Policy applied to the iframe contentsNot the script or origin restrictions provided by sandbox
referrerpolicyControls the referrer policy for fetches initiated by the elementDoes not grant the parent DOM access to the child
loadingParticipates in deciding whether navigation is lazy-loadedIs a loading hint, not a security or permission boundary
allowfullscreenRelates to Fullscreen API use by the iframe contentsFullscreen conditions, Permissions Policy, and user activation still matter

Adding an attribute does not guarantee that a capability will work. HTTP Permissions Policy, CSP, sandboxing, user activation, and user-agent behavior can all contribute conditions.

Accessibility

HTML-AAM gives iframe no corresponding WAI-ARIA role, while defining platform-specific mappings such as an internal frame. The iframe's accessible name can be computed from aria-label, aria-labelledby, or title. The embedded Document has its own naming condition based on its own title element.

<iframe
  src="https://example.com/payment"
  title="Secure payment form"
></iframe>

The parent's title does not replace checking the embedded service itself. Record the child Document's title, headings, keyboard behavior, focus, announcements, and error presentation separately from the parent Accessibility Tree.

Fact / Evidence

Normative claims about the element and its processing model are separated from browser implementation, WPT, and accessibility observations.

Major facts and source locations
TypeFact / claimCondition / scopeStatusSource
SPECThe iframe element represents the embedded content navigable.Meaning, categories, context, and content modelReviewedHTML Standard: the iframe element
SPECWhen srcdoc is present, the user agent constructs that Document and gives it priority over src.srcdoc document, about:srcdoc, and both attributes presentReviewedHTML Standard: srcdoc processing
SPECsandbox applies additional restrictions to iframe contents and lets tokens re-enable particular capabilities.Opaque origin, scripts, forms, popups, and top navigationReviewedHTML Standard: sandboxing
SPECallow specifies Permissions Policy applied to the iframe contents.Iframe policy container and Permissions PolicyReviewedHTML Standard: allow
SPECloading participates in the decision to defer iframe navigation.Lazy loading, intersection observation, and load eventsReviewedHTML Standard: loading
SPECThe iframe accessible name is computed through conditions including aria-label, aria-labelledby, and title.Iframe element, child Document title, and platform mappingsReviewedHTML-AAM: iframe

Evidence

  1. HTML Standard: The iframe element — categories, content model, attributes, content navigables, src/srcdoc, sandboxing, navigation, load, and the DOM interface
  2. Permissions Policy: iframe allow attribute — the iframe policy container and delegated policy
  3. HTML Accessibility API Mappings: iframe — platform role mappings and accessible-name computation
  4. Web Platform Tests: the-iframe-element — entry point for tests related to iframe attributes, navigation, sandboxing, loading, and DOM APIs

Implementation Evidence

Normative processing is recorded separately from browser observations of navigation, load, DOM access, sandboxing, and accessibility trees. A dedicated fixture was run in Chrome 153.0.0.0 on Windows NT 10.0, and only the observed range is registered as partial evidence.

Executed fixture: iframe-v1 checked srcdoc precedence, initial about:blank, srcdoc mutation and load, same-origin contentDocument, the sandbox event-origin boundary, and titled accessibility-tree entries. The execution record is stored at docs/atlas/iframe-v1-results-2026-09-19.md.

Implementation evidence registry for the iframe element
TypeReproduction scopeConditions to recordStatus
IMPLsrc/srcdoc precedence, initial about:blank, srcdoc mutation, load, same-origin contentDocument/contentWindow, sandbox event origin, and loading/allow/referrerpolicy reflectionChrome 153.0.0.0 / Windows NT 10.0 / 2026-09-19 / fixture ID iframe-v1. All 8 checks passed. Actual lazy loading, Firefox/Safari, and complex cross-origin interactions remain unrunPartial
WPTIndividual tests for the iframe element, srcdoc, sandboxing, navigation, load, and DOM APIsSelected files under the-iframe-element have not been run; browser, date, pass/fail, and unrun reasons remain to be recordedNot run
AAMInternal-frame mapping, title naming, child Document title, and focusabilityChrome 153 accessibility tree observation exposed parent iframe descriptions and the srcdoc, same-origin, and sandbox child Document names. Assistive technology, platform APIs, Firefox, and Safari were not testedPartial observation

Iframe rendering, load behavior, DOM access, origin, sandboxing, Permissions Policy, and accessibility-tree exposure can depend on the URL, HTTP headers, parent/child origins, attributes, user agent, and OS. A single-environment observation will not be registered as universal behavior.

Coverage / Open Issues

  • CoveredMeaning, categories, context, content model, major attributes, and the HTMLIFrameElement entry points
  • CoveredNormative entry points for src/srcdoc precedence, initial about:blank, content navigables, navigation, and load
  • CoveredSandboxing, allow, referrerpolicy, loading, and accessible-name source locations
  • PartialChrome 153 observations of srcdoc precedence, initial about:blank, srcdoc mutation and load, same-origin DOM access, sandbox event origin, attribute reflection, and the accessibility tree
  • OpenFirefox/Safari comparison of srcdoc, load, attribute changes, sandboxing, loading, and contentDocument, plus Chrome's actual lazy-loading behavior
  • OpenInteractions among cross-origin behavior, CSP, COEP/CORP, Permissions Policy, postMessage, window.name, and navigation
  • OpenIndividual WPT results, complete HTML-AAM platform mappings, assistive-technology observations, compatibility, and Expert-gap Review

This is initial coverage. It records normative entry points and evidence boundaries without claiming identical results across browsers, HTTP-header configurations, origin setups, embedded services, or assistive technologies.

Related surface

For a beginner-friendly explanation of embedding, title, sandbox, srcdoc, and the difference from links, see the iframe element page in Yugien. For navigation boundaries, see the a element; for script fetching and execution, see the script element; and for form submission, see the form element.