Browser
An embedded browser surface: a page that loads a remote http(s) origin inside the app, in a rectangle the app reserves. The plugin is always registered; the section names the origins it may load.
// crust.config.ts
browser: {
origins: ["https://example.com", "https://status.example.com"],
},
An entry is an origin — scheme, host and port — never a path: the check a load goes through compares origins, so a path in this list would authorise nothing while reading as though it did. A path, query or fragment in an entry is a config error naming its index.
An overlay, not a DOM element
A native webview cannot be hosted by the page's DOM, so the app supplies a rectangle in window points and reserves the space itself:
await crust.invoke("browser", "open", {
label: "docs",
url: "https://example.com/",
bounds: { x: 0, y: 0, width: 480, height: 640 },
});
browser.open creates one surface; navigate points it at another allowlisted origin; state answers { url, title, loading, canGoBack, canGoForward }; setBounds moves and resizes it; close ends it. The app owns the chrome and re-applies bounds when the window resizes.
Capturing the surface
browser.capture { label } answers { ok, width, height, scale, png } — a base64 PNG with no data: prefix, at the surface's own page pixels. It exists because a browser surface is a native sibling view: window.capture photographs the app's own WKWebView and a native view beside it is never part of that render, so the overlay is missing from the picture. browser.capture is the picture of what was embedded, and its width/height are the surface's page pixels — the bound in points times scale, so a 480×640 surface on a Retina display reports 960×1280. An unknown label is not-found.
The surface runs from its own webview — a WKWebView configuration on macOS, a WebView2 controller in a child window on Windows, a WebKitWebView in the window's overlay on Linux — so it carries no bridge token and no window.crust. Anything that must read the embedded page belongs in your backend, against an API, not in an embedded browser.
target=_blank and window.open never create a second webview. The URL is re-checked against browser.origins and, when allowed, handed to the system browser through the opener; the page is told on browser:popup. Each platform refuses it in its own place: a WKUIDelegate on macOS, the NewWindowRequested event with Handled set on Windows, and the create signal on Linux.
capture is macOS-only: WebKit renders the surface's own picture there, while WebView2's CapturePreview needs an IStream and WebKitGTK's get_snapshot answers a cairo surface, so both answer not-implemented naming the call — never a screenshot of the screen, which would show something else.
Absent means nothing loads
No browser section still registers the plugin, with an empty allow list, so every load is refused. Nothing remote loads by default; naming an origin is the only way one does. That is the same deny-by-default shape as shell's allow list.
Capability
The page calls browser.open, so a label needs the action browser:open; every other command is its own action too, browser:capture included, since an action is plugin:command. It is not implied by another surface's grant: an embedded browser can reach the network under your app's identity, so it is granted on its own, per window label. See Permissions.