@mayurajs/browser-browserview
v1.2.0
Published
BrowserView browsers for mayura/browser, over its sessions API.
Readme
@mayurajs/browser-browserview
BrowserView browsers for mayura/browser: hosted Chromium sessions, created over
BrowserView's sessions API and driven over CDP, with no dependency.
npm install mayura @mayurajs/browser-browserviewimport { createBrowsers } from 'mayura/browser';
import { browserViewBrowsers } from '@mayurajs/browser-browserview';
const browsers = createBrowsers(browserViewBrowsers({ apiKey }), {
maxBrowsers: 2, maxLifetimeMs: 15 * 60_000,
origins: ['https://example.com'],
});
const browser = await browsers.open();
await browser.goto('https://example.com/');
await browser.release();- Each browser is a session: created when opened, released when done. It is not kept alive (BrowserView's own default is to keep it), so it also ends shortly after its connection does; BrowserView ends it at its lifetime, given as its timeout (BrowserView's plans cap it at 15 minutes or 4 hours). Release is idempotent.
- Stealth is off, though BrowserView turns it on by default; turn it on with
stealth. Proxies, captcha solving, downloads, recording and BrowserView's agent are off. No idle timeout unlessidleTimeoutSeconds. Labels become metadata. - BrowserView's CDP connection needs the session's token in an
x-session-tokenheader. Node and Bun send it; on Workers or Deno, givecreateBrowsersawebSocketthat can. liveViewUrlis BrowserView's watch link by default (liveView: 'view');'interact'gives its viewer, whose token lets whoever has the link use the browser;falsegives none.- Origins are enforced inside the browser, by intercepting its requests over CDP; a live check against BrowserView confirmed it on October 6, 2026. Should a connection ever not allow that, opening a browser fails rather than running unchecked.
- Options:
apiKey,liveView,stealth,idleTimeoutSeconds,maxLifetimeMs(4 hours),fetch,baseUrl.
See the browser guide. Apache-2.0.
