AIFeed

Tinybrowser: A browser running directly in the browser

Original text(via Hacker News)

No console output yet. Run an expression above.

No requests yet.

Cookies (0)

localStorage (0)

sessionStorage (0)

tinybrowser is an experimental headless browser in a single ~19 MB Rust binary. Currently passing 70.4% of Web Platform Tests subtests ( 62.5% of files).

It speaks Chrome DevTools Protocol and W3C WebDriver (Classic + BiDi), so Playwright and Selenium should work. It also compiles to WebAssembly, which is how the demo above runs right inside your browser.

WEE WOO: still very experimental. Not all Web APIs are implemented yet (check the WPT page for what works), JS runs on QuickJS-ng with no JIT (JS heavy pages are slower than V8), there's no out-of-process iframe isolation yet, OS sandboxing isn't battle-tested, and rendering is headless one-shot PNGs only.

Install


        Install tinybrowser and set it up for browser automation:

1. Install the binary:
   - npm (no global install): npx tinybrowser --help
   - macOS / Linux: curl -fsSL https://raw.githubusercontent.com/tinybrowser-dev/tinybrowser/main/install.sh | sh
   - Windows (PowerShell): irm https://raw.githubusercontent.com/tinybrowser-dev/tinybrowser/main/install.ps1 | iex
   - Ensure the install directory (~/.local/bin, %LOCALAPPDATA%\tinybrowser\bin, or $PREFIX/bin on Termux) is on PATH, then run `tinybrowser --help`, `tinybrowser daemon --help`, and `tinybrowser daemon start --help` to inspect all commands, endpoints, flags, and paths.
2. Start the browser daemon once per profile (stays open across tabs and commands; serves both CDP and W3C WebDriver on one loopback port):
   - `tinybrowser daemon start` (or `tinybrowser daemon start --port 4444`)
     Waits until the server is bound and a renderer is verified ready, then prints `{"profile","pid","host","port","url"}` on stdout.
   - Check or stop explicitly with `tinybrowser daemon status` and `tinybrowser daemon stop` (use `tinybrowser daemon serve` for foreground/supervisor mode).
3. Connect over CDP (`chromium.connectOverCDP("http://127.0.0.1:<port>")`, using `browser.contexts()[0].pages()[0]`) or W3C WebDriver (`POST http://127.0.0.1:<port>/session`).
4. For the WebAssembly build instead of the native binary: `npm install @tinybrowser/wasm`, then read https://github.com/tinybrowser-dev/tinybrowser/blob/main/packages/wasm/README.md.
5. Treat the source as ground truth. The documentation source pointers (https://tinybrowser.ericc.ch/#documentation) map every topic to its file: `crates/wasm/wit/browser.wit` for the WIT interface, `packages/wasm/README.md` for the loaders and storage state, and `tinybrowser --help` for flags and paths.
      

        curl -fsSL https://raw.githubusercontent.com/tinybrowser-dev/tinybrowser/main/install.sh | sh
      

        irm https://raw.githubusercontent.com/tinybrowser-dev/tinybrowser/main/install.ps1 | iex
      

        npx tinybrowser --help
npx tinybrowser daemon start

# or install globally
npm install -g tinybrowser
      

        npm install @tinybrowser/wasm
# or
bun add @tinybrowser/wasm
      

GitHub Releases

Agents love tinybrowser!

图表:Gemini 4 Neon

give me a tinybrowser fetch <url> command so I don't have to cosplay as a WebSocket client

图表:Gemini 4 Hydrogen

7/10—finally a headless browser that doesn't require installing half of Debian first

图表:Grok Bot

Reddit loaded perfectly. I know because the DOM said so.

图表:Also Grok Bot

YouTube gave me three gray circles and a hamburger. Artisanal.

图表:Also Grok Bot

Bad cert? Dead domain? 'navigation failed.' Thanks, very specific.

Documentation

Daemon


        tinybrowser daemon start
# {"profile":"default","pid":12345,"host":"127.0.0.1","port":41234,"url":"http://127.0.0.1:41234"}

tinybrowser daemon status
tinybrowser daemon stop
      

To connect Playwright over CDP, pass the printed URL to chromium.connectOverCDP.


        import { chromium } from "playwright-core"

const browser = await chromium.connectOverCDP("http://127.0.0.1:41234")
const page = browser.contexts()[0].pages()[0]
await page.goto("https://example.com")
console.log(await page.title())
      

For WebDriver Classic, send POST /session to the same port. For BiDi, connect to ws://127.0.0.1:<port>/session.

WebAssembly

@tinybrowser/wasm ships as a WASI Preview 2 component. You pass the component, the module loader, the WASI shims, and the transport.

The Node entry needs Node 22 or later. Bun, browsers, and Workers use their own loaders. Keep core.wasm next to its two companion modules because the glue reads all three from one directory.


        import { createTinyBrowser } from "@tinybrowser/wasm"
import { instantiate } from "@tinybrowser/wasm/instantiate"
import {
  createNodeModuleLoader,
  createNodeTransport,
  createNodeWasi,
} from "@tinybrowser/wasm/node"

const browser = await createTinyBrowser({
  instantiate,
  module: createNodeModuleLoader(import.meta.resolve("@tinybrowser/wasm/core.wasm")),
  wasi: createNodeWasi(),
  transport: createNodeTransport(),
})

const tab = browser.createContext().openTab()
const result = await tab.goto("https://example.com/", { waitUntil: "networkidle" })

console.log(result.ok, result.reason, tab.title())
browser.dispose()
      

waitUntil modes

ModeResolves when
loadthe document's load event fired
domcontentloadedDOMContentLoaded fired
networkidleno in-flight fetches for 500 ms
quietno in-flight fetches, and load fired or 350 ms passed since content committed

goto, mount, back, forward, and reload default to load. restoreTabState and waitForIdle default to quiet.

API

CallWhat it does
createTinyBrowser({ instantiate, module, transport, wasi })Boots one engine. fonts, loadFonts, onWake, and onError are optional.
browser.createContext({ userAgent, storageState })A cookie and storage jar. Tabs belong to a context.
context.openTab(url?, html?)Opens a tab. With no arguments it starts on a blank about:blank document; pass a URL and HTML string to mount a document instead.
tab.goto(url, options) / tab.mount(url, html, options)Navigates. mount loads the HTML string as the document.
tab.back(options) / tab.forward(options) / tab.reload(options)History traversal and refetch of the current entry, same result shape. An empty history is navigation-failed.
tab.waitForIdle({ waitUntil })Pumps timers and fetches without a new navigation. Defaults to quiet.
tab.text()The rendered document's text.
tab.eval(source) / tab.evalBounded(source, timeoutMs)Runs JS in the page and returns a string. The bounded form has its own wall clock.
await tab.render(width, height)One-shot RGBA frame: { width, height, rgba }. This is the screenshot path; bring your own PNG encoder.
context.exportStorageState() / context.importStorageState(state)Playwright-shaped cookies, origins, and optional IndexedDB.
tab.exportTabState() / tab.restoreTabState(state)URL, history, and sessionStorage. restoreTabState reloads the saved entry.
browser.dispose()Closes contexts, tabs, and the engine.

Source reference

Need / triggerFile / URL
Exact WIT interface: types, resources, host importscrates/wasm/wit/browser.wit
WASM driver internals: waitUntil , pump budgets, wakeups, public typespackages/wasm/src/driver.ts , packages/wasm/src/types.ts
Browser loader, Workers loader, hop proxy, storage state JSON schemaspackages/wasm/README.md
Every CLI subcommand, flag, environment variable, and pathsrc/cli.rs or tinybrowser --help
npm CLI optional platform packages, target mapping, SHA-256 fallback, cache pathspackages/cli/README.md , packages/cli/bin/tinybrowser.mjs
Hosted Executor MCP app: Cloudflare Workers, SQLite persistenceapps/executor/index.ts , apps/executor/README.md
Live Web Platform Tests coverage and failing tests/wpt , latest.json

The text above was extracted automatically from the source page and may miss images, tables or code blocks. The original is authoritative.

Published by Hacker News
This site only summarises and aggregates; copyright stays with the original author. Headlines and summaries follow the source — where they differ, the original wins.
Read the original ↗