Options
RendererOptions
Accepted by both new Renderer() and new PrerenderServer().
| Option | Type | Default | Description |
|---|---|---|---|
timeout | number | 20000 | Navigation timeout in milliseconds, passed to page.goto |
waitUntil | "load" | "domcontentloaded" | "networkidle0" | "networkidle2" | "networkidle2" | When the page is considered ready |
extraWaitMs | number | 0 | Extra delay after waitUntil is met, for late client rendering |
userAgent | string | "Mozilla/5.0 (compatible; headless-prerender)" | User-Agent reported to the target page |
width | number | 1280 | Viewport width in CSS pixels |
height | number | 800 | Viewport height in CSS pixels |
blockResourceTypes | string[] | ["image", "media", "font"] | Puppeteer resource types to abort during render |
allowedOrigins | string[] | [] | If non-empty, only URLs on these origins may be rendered |
executablePath | string | bundled Chromium | Path to a Chromium/Chrome binary |
launchArgs | string[] | [] | Extra command-line flags appended to Chromium's launch args |
waitUntil values
| Value | Ready when |
|---|---|
load | The load event fires |
domcontentloaded | The DOMContentLoaded event fires |
networkidle0 | No network connections for 500 ms |
networkidle2 | At most 2 network connections for 500 ms |
networkidle2 is a good default for SPAs that poll or keep a connection open. Use networkidle0 for apps that go fully quiet after loading, combined with a small extraWaitMs.
blockResourceTypes
Blocking image, media, and font requests speeds up rendering and lowers memory use without affecting the HTML that crawlers read. Set it to [] to load everything, or add types like stylesheet if you are certain CSS does not affect the DOM you need.
Valid values follow Puppeteer's ResourceType: document, stylesheet, image, media, font, script, texttrack, xhr, fetch, eventsource, websocket, manifest, other.
WARNING
Do not block script or xhr/fetch - the page needs them to render.
launchArgs
Appended after the built-in flags (--no-sandbox, --disable-setuid-sandbox, --disable-dev-shm-usage, --disable-gpu).
new Renderer({
launchArgs: ["--proxy-server=http://127.0.0.1:8888", "--lang=en-US"],
});ServerOptions
Extends RendererOptions with:
| Option | Type | Default | Description |
|---|---|---|---|
port | number | 3000 | TCP port |
host | string | "0.0.0.0" | Bind interface |
cacheTtlMs | number | 0 | In-memory cache TTL; 0 disables it |
token | string | none | Required access token |
RenderResult
Returned by Renderer.render().
| Field | Type | Description |
|---|---|---|
html | string | Fully-rendered HTML document |
status | number | Top-level navigation HTTP status (0 if unknown) |
url | string | Final URL after redirects |
durationMs | number | Render time in milliseconds |