Skip to content

HTML pages

An HTML artifact is a single file. Everything the page needs travels inside it: markup, styles and scripts. Publish with kind: "html", which is the default.

The viewer is rendered by Artiflow and puts your bytes into an iframe:

  • sandbox="allow-scripts" without allow-same-origin, so the document runs in an opaque origin. It cannot read the dashboard’s cookies, storage or DOM, and it cannot claim the application origin.
  • The bytes travel in srcdoc, escaped by the server, so a page can never execute on the application origin itself.
  • The response carries this policy:
default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; frame-src 'self'; base-uri 'none'; form-action 'none'; connect-src 'self'

The last directive belongs to the viewer page, not to your document: the page polls the artifact’s own metadata so it can notice a new revision and swap the document in place. Your document inherits the same list, but it cannot read an authenticated answer: in an opaque origin a same-origin call matches nothing under CSP3 'self', and an authenticated response is unreadable from there in any case. It reaches no parent page, no storage and no other origin.

Inside the artifact Result
Inline <style>, inline <script> Runs
Inline SVG, CSS shapes, <canvas> 2D drawing Runs
fetch, XMLHttpRequest, WebSocket, sendBeacon Blocked: no remote host; a same-origin call carries no cookies
External scripts, stylesheets, fonts or images Blocked: each is a network request
localStorage, sessionStorage, IndexedDB, cookies Unavailable: the origin is opaque
Form submission Blocked
Replacing the top-level page, opening popups Blocked
A link inside the page Can navigate the frame itself away from the page

So there are no CDN links, no web fonts, no remote images and no analytics. Use system font stacks, inline SVG and CSS for visuals, and computed values for anything that would normally be fetched. A page that depends on a network request renders incomplete rather than failing loudly.

Inline scripts may do real work: compute numbers, draw charts, toggle a small amount of state. That is enough for dashboards, reports, comparisons and one-page explainers, which is the kind of artifact this viewer is built for.

The bar above the page shows the title and the version, and offers Focus, which gives the page the whole window; the F key toggles it and Esc leaves it. The version badge increments with every new revision, so a reader can tell that the page changed.

The public link renders the same page in the same sandbox without the bar and without a back link.

There is no in-browser editor for HTML. To change a page, publish a new revision through the agent, naming the artifact and the revision you are replacing:

artifact_write (update)
{
"artifactId": "3f1c0e6a-8b2d-4d3f-9a71-0c5b8e2d4a19",
"expectedRevisionId": "9d2b7c44-1e3a-4b8f-8d0e-6a1f2c3b4d5e",
"title": "Pricing comparison",
"text": "<!doctype html>…"
}

artifactId must be the artifact’s canonical lowercase UUID; anything else is refused before any read or write. expectedRevisionId is optional there, but sending it is what turns a blind overwrite into a conflict you can see. Edit and revise covers the same rule from the editor side.