Docs / For developers
HTML pages
An HTML page is a kind of page whose content is one HTML document. Worlds shows it in a sandbox, styled to match the rest of your pages. It is for things blocks cannot do well: a calculator, a tracker with its own logic, a designed one-page report, or a small interactive explainer.
HTML pages are not in the current release of Worlds. This page describes them as they will arrive in a coming release.
Creating an HTML page
Create the page
In the Windows app choose New HTML page from the New menu (after Drawing) or from the command palette. Its description: "A designed page in HTML: a tool, a tracker or a report". The page starts with starter content in your interface language.
Write it, or ask Claude
Switch between Page and Source. In Source mode the editor sits beside the running page. Or ask Claude to build the page for you.
Saving is automatic
The source is saved a moment after your last keystroke. If it breaks a rule you see Not saved with the reason, and the page keeps its last good version.
The rules
These rules protect your computer and your pages. If one is broken, saving is refused with the reason:
- One self-contained document, at most 1 MB. A full document, or just the
<body>content, which Worlds wraps. - Nothing from the network. No
<script src>, no stylesheet or@importfrom an address, no images, video or audio from a link. Images are inline SVG ordata:addresses. The sandbox blocks the network entirely. - No embedding or redirects. No
<iframe>,<object>,<embed>,<base>,<meta http-equiv>or<form action>. - Scripts are inline only. They run with no network, no cookies or storage, and no access to Worlds or other pages.
Design rules come back as warnings, and the page is still saved:
- Colours come from the Worlds variables such as
--w-text,--w-surfaceand--w-accent, not many fixed colours. - The page works from 360 px wide to the full page width, with no
100vhand noposition: fixed. - Arabic is written right to left:
lang="ar" dir="rtl". Worlds adds it when the app is in Arabic and the page sets none. - Quiet design and real content, with no placeholder text or made-up figures.
Plain HTML elements (headings, paragraphs, lists, tables, buttons and inputs) are already styled like Worlds. There are ready classes such as .w-card for a card, .w-stat for a figure with its label, .w-bar for a progress bar and .w-grid for wrapping columns.
Keeping data: worlds.save
The page cannot use browser storage. To let a calculator or tracker remember what you entered, it uses the worlds object:
worlds.state- The JSON value the page last saved, or
null worlds.save(value)- Keeps a JSON value with the page, up to 256 KB. A larger value throws an error.
worlds.lang"ar"or"en", the app's language
<button id="add">+1</button> <b id="n"></b>
<script>
let count = (worlds.state && worlds.state.count) || 0;
const show = () => { document.getElementById("n").textContent = count; };
document.getElementById("add").onclick = () => { count++; worlds.save({ count }); show(); };
show();
</script>
People who cannot edit the page can call worlds.save, but nothing is kept for them.
Links: https:// and mailto: open in the browser after you click. worlds://page/ followed by a page id opens another Worlds page.
On each platform
| Platform | What you see |
|---|---|
| Windows | The page runs inside Worlds, with Source mode to edit it. Its height follows its content. |
| Android | The page fills the screen and runs without internet, and worlds.save works. The source is read only: "Runs here without the internet. Edit its source in Worlds on the desktop." |
| iPhone, iPad and Mac | The page fills the screen and runs without internet, and the source is read only. worlds.save works when the page is in a workspace or local copy that can be written to; otherwise you see "Read only". |
On phones, links open only right after you tap them, and the page gets a 16 px edge.
How Claude writes them
Ask Claude in a chat for an HTML page, such as "a calculator for my grade average" or "a tracker for this month's spending". It has three tools:
html_pages_rulesreads the rules above before writing.html_pages_readreads the page's source, its saved data, and any errors and warnings.html_pages_writewrites the source. It is refused if a rule is broken, and it leaves the saved data alone.
It can also create a new HTML page directly. Before every write Worlds saves a version of the page, so you can undo any change from History. The same tools are available to any program connected through the MCP server.
The visible text of an HTML page is included in search like any other page.