JAVASCRIPT RENDERING

Capture the page after JavaScript builds the interface

Load modern client-rendered pages in a real browser, allow required content to settle, optionally run a controlled pre-capture script, and record the resulting viewport or full page. Use deterministic inputs instead of capturing the empty application shell returned by the first HTTP response.

Real browser
Client code executes
delay
Bounded settling time
javascriptCode
Optional page preparation
Install:curl -X POST https://api.prod.ss.snapshot-site.com/api/v2/screenshot
Auth:x-snapshotsiteapi-key: YOUR_API_KEY
Get started for free
Rendered page state
Dynamic webpage layers assembling inside a browser renderer before screenshot capture
Good fits
React, Vue, Angular, Svelte, and other client-rendered pages
Dashboards and charts that appear after navigation
Responsive pages with asynchronous sections
Stable QA captures after removing transient UI

A rendered screenshot is a page state, not a response body

Modern servers often return an HTML shell that becomes useful only after scripts run. Snapshot Site opens the URL in a browser, then captures the state produced by the page and the options you provide.

1

Load the target URL

Use a complete HTTP or HTTPS URL that the rendering environment can reach without relying on a developer's local session.

2

Allow required work to finish

Use a short delay when hydration, data fetching, charts, or fonts settle after the initial navigation.

3

Prepare the page when necessary

Use javascriptCode for controlled page adjustments such as pausing motion or opening a state on pages you are authorized to automate.

4

Capture with fixed inputs

Keep viewport, timing, locale, full-page mode, and cleanup options identical when outputs need to be compared.

Quick start

Render a client-side page

1

Choose a reachable page and the responsive viewport to capture

2

POST it to the v2 screenshot endpoint with a small delay

3

Add javascriptCode or hide selectors only for a documented page requirement

4

Validate the response and inspect the first outputs before scaling

JavaScript rendering example

cURL

Settle a dashboard and disable motion

Render a dashboard, wait briefly for client work, and disable CSS motion immediately before capture.

curl --request POST \
  --url https://api.prod.ss.snapshot-site.com/api/v2/screenshot \
  --header 'Content-Type: application/json' \
  --header 'x-snapshotsiteapi-key: YOUR_API_KEY' \
  --data '{
    "url": "https://example.com/dashboard-preview",
    "format": "png",
    "width": 1440,
    "fullSize": true,
    "delay": 2,
    "hideCookie": true,
    "javascriptCode": "document.querySelectorAll(\"*\").forEach((el) => { el.style.animation = \"none\"; el.style.transition = \"none\"; });"
  }'

Why JavaScript rendering changes screenshot automation

Traditional HTML fetching stops when the response body arrives. Modern applications may have delivered only a root element, script references, and loading placeholders at that point. The useful page state appears later, after the browser downloads application code, hydrates components, requests data, loads fonts, and paints the interface.

A screenshot taken too early can be technically successful and still be wrong. It may contain an empty shell, a skeleton loader, a chart without data, or a layout using fallback fonts. The API needs to render the page and the workflow needs to define which state counts as ready.

Snapshot Site handles the browser process and exposes bounded controls such as delay, javascriptCode, hide, and hideCookie. Those controls are most effective when they describe a known page rather than trying to make every arbitrary website deterministic.

Choose a reliable readiness strategy

Prefer pages with deterministic preview states

If you control the application, create preview URLs that load the required data without depending on an interactive user session. A report route can use a fixed report identifier; a component gallery can use a stable fixture; a campaign preview can use a content revision. This is more reliable than navigating a generic dashboard that changes with the current account.

Keep live timestamps, random recommendations, and rotating promotions out of the preview. They generate pixel differences even when the implementation has not regressed.

Use delay as a bounded allowance

The delay option gives late client work time to settle. Begin with the smallest value that succeeds across representative pages. If two seconds works for one route but another regularly needs ten, investigate the second route rather than raising the default for the whole site.

A delay cannot fix missing access, a failed API request, or a component waiting forever. Check the page in a clean browser session and review its network and console behavior when output stays incomplete.

Use page code narrowly

javascriptCode is useful for preparing a controlled state immediately before capture. It can disable animations, expand a component, or set a harmless UI state. Keep the script small, version it with the capture configuration, and restrict it to pages you own or are authorized to automate.

Do not treat injected code as a universal scraper. It increases coupling to page markup and can break silently when selectors change. Prefer the hide option for simple removal and application-owned preview routes for complex state.

Common rendering problems

Hydration and asynchronous data

A server-rendered heading can appear immediately while the table below it arrives later. Capturing after the first paint produces a mixed state. Use a controlled preview route or a measured delay, and verify that the final output contains the data required by the workflow.

Web fonts and layout shifts

Fallback fonts change line breaks, card heights, and navigation width. Serve fonts reliably, avoid blocking cross-origin policies, and test output from the rendering environment. A page that looks stable after several seconds on a developer machine may behave differently without a warm cache.

Animations and rotating content

CSS transitions, carousels, countdowns, and canvas animations can produce a different frame on every run. Disable motion on application-owned pages or remove the volatile region. For visual comparisons, the goal is not to freeze the entire internet; it is to keep the page regions relevant to the decision stable.

Consent and overlay state

A cookie dialog can cover most of a mobile viewport or lock document scrolling. Use hideCookie for supported common banners and verify the result. Site-specific overlays may need a maintained selector or a preview route that does not show them.

Use cases for rendered page capture

Visual regression and release QA

Render production and staging with the same settings, then use the Visual Diff API to produce mismatch information and a diff image. Start with critical routes and add pages only when someone owns the resulting review.

Documentation maintenance

Product documentation often captures a client-rendered interface. Tie each image to a known preview state and regenerate it after relevant UI changes. This is safer than capturing an employee account with changing personal data.

Monitoring public pages

Scheduled rendering can detect a blank application shell, a failed chart, or a missing client-side section that an HTTP status check misses. The Website Monitoring API covers baseline and alert design, while the Screenshot Scheduler covers external triggers.

Page analysis

The AI Website Analysis API works on a rendered page state and returns its documented summary, topic, metadata, and quality signals. Use visual diff when the exact pixels matter and analysis when the question is about page meaning or quality.

Security and performance

Keep the API key in a server-side secret store. Validate user-provided URLs before creating rendering jobs, avoid logging sensitive query parameters, and do not execute arbitrary user-supplied javascriptCode without a strong trust boundary.

Render only as often as the business requirement justifies. Cache stable outputs, prevent overlapping jobs, and use viewport capture when the full document is unnecessary. For large route matrices, queue work and cap concurrency rather than launching every page at once.

JavaScript rendering checklist

  1. Use a reachable, deterministic page URL.
  2. Fix viewport, format, locale, and full-page behavior.
  3. Measure the delay required by representative pages.
  4. Disable or remove known volatile regions.
  5. Keep injected code small, reviewed, and authorized.
  6. Validate the response and inspect early samples.
  7. Compare only captures made with the same settings.
  8. Store credentials outside the page and client application.

JavaScript rendering FAQ

Does Snapshot Site execute JavaScript before taking a screenshot?

Yes. The target page is opened in a real browser, so its client-side application can render before capture.

When should I use the delay option?

Use a small measured delay when required content appears after navigation. Do not use a long delay as a substitute for understanding the page state.

What does javascriptCode do?

It runs supplied page code before capture on supported screenshot endpoints. Use it only on pages and workflows you are authorized to automate.

Can JavaScript rendering capture a page behind my local login?

Not automatically. A browser session on your laptop is not shared with the rendering service. Use a dedicated reachable preview state or another reviewed authentication design.

Why is a JavaScript screenshot blank or incomplete?

The page may require unavailable authentication, load data late, encounter a browser error, show a bot challenge, or depend on a resource the renderer cannot reach. Test the URL independently and inspect the response.

Can I hide dynamic elements before capture?

Yes. Use the documented hide selector option for known elements, hideCookie for common consent banners, or controlled page code when necessary.

How do I make rendered screenshots reproducible?

Fix the URL state, viewport, timing, locale, output format, full-page option, and cleanup rules. Remove animations, timestamps, and rotating content when possible.

Is a screenshot API a replacement for Playwright or Puppeteer?

No. Use Playwright or Puppeteer for arbitrary multi-step browser interaction. Use a screenshot API when the application needs a focused rendered output without owning the browser lifecycle.

Capture the state users actually see

Test one representative client-rendered route with explicit timing and viewport settings, then reuse the proven configuration across the workflow.