Skip to content

API reference / Common / webpageDocument

Function: webpageDocument() ​

ts
function webpageDocument(options?): ExtensionDocument;

A web page document, docType "webpage": a page framed in an iframe, under a bar with its address and a link to open it in a new tab. Its one format is "url".

One is built in, with no canOpen: open(url, { format: "url" }) frames a page, and a URL given no format is never taken for one, as taking every URL would frame a PDF the engine should read. To frame some URLs without a format — a host's Figma or Loom embeds, say — register one with a canOpen saying which, with the extensionDocuments option or registerExtensionDocument; it replaces the built-in one.

A site that refuses to be framed leaves the frame without its page, which the page framing it can't tell from a slow one, so the link always shows. The frame is sandboxed: a page runs its scripts, keeps its own origin, submits forms and opens links in new tabs, and may autoplay, copy, play encrypted media and go full screen or picture-in-picture — but not navigate the host's page. A page from the host's own origin isn't held by it: allowed its scripts and its origin, it can lift the sandbox. A page follows the theme through its prefers-color-scheme.

Parameters ​

ParameterType
options?WebpageDocumentOptions