map.examplehttps://cafe.example/about:blankloading="lazy"CafeCafemap.examplerefused to be framedFind usscreen reader:“Map to our cafe”sandbox1<h1>Find us</h1>2<iframe src="https://map.example/cafe"3 title="Map to our cafe"4 width="400" height="300"5 loading="lazy"></iframe>your page's DOM · cafe.examplenode 1node 2node 3node 4node 5JSthe frame's own DOM · map.examplenode 1node 2node 3node 4node 5<iframe>contentDocumentnullframe-ancestors
Front: the outer page's file, its script, and the two DOMs (yours, the frame's)Back: the browser with the frame box, and the other site, map.exampleMovers: the iframe chip, the frame's own request and document, a probe, a message, a refusalFront left: index.html from cafe.example, five lines with one iframe element. Back right: the browser showing that page; back left: the other site, map.example. Front right: the page's script and two DOM rows. The iframe chip makes an empty about:blank box; the frame then sends its own request to map.example, and the map page comes back as a second document whose nodes fill only the frame's DOM row. A contentDocument probe from the script bounces back as null (a different origin); a postMessage envelope gets through. A sandbox fence and a frame-ancestors refusal show the two ways a frame can be limited.

A box in the page

  1. An iframe (inline frame) embeds a whole second web page inside yours. That page is loaded and parsed on its own: it gets its own document, its own DOM tree and its own JavaScript window.

Its own document

Walls and doors

What happens

;; step 1/10 · page-in-page
file     index.html on https://cafe.example   (5 lines)
  1  <h1>Find us</h1>
  2  <iframe src="https://map.example/cafe"
  3    title="Map to our cafe"
  4    width="400" height="300"
  5    loading="lazy"></iframe>
iframe   inline frame: one element, one box,
         and a separate page living inside it

Until the src page arrives, every new frame holds an "initial about:blank" document that already has html, head and body elements. It is replaced when the real page loads. The outer page's load event waits for its frames (and images and stylesheets) to finish loading, but the parser itself never stops for a frame.