GitHub 37
Skip to content
ViteHub is still experimental. Expect bugs and breaking changes.

Browser

Open web pages in a cloud browser from your server, and get back HTML, screenshots, or data.

Deploys on
server/browsers/page-html.ts
import { defineBrowser } from 'vite-hub/browser'

// Returns the HTML of a page after it renders
export default defineBrowser(async (
  input: { url: string },
  { browser },
) => {
  return await browser.content(input.url)
})
server/browsers/page-html.ts

One file per task

Add a file to server/browsers and run it by name with runBrowser().

Several steps on one page

browser.open() keeps a page open to follow links, click, and fill forms, then closes it.

Quick calls without a file

Get HTML, Markdown, links, a screenshot, or a PDF in one function call.

No browser setup in your app

browser: true adds the Cloudflare binding at build time, so routes import no Cloudflare code.

Full control when you need it

Use Playwright, or run local Chromium on a trusted Node server.

Check the URLs you open

Check every URL that users send. Treat page content as untrusted.