Guides / HTML output
HTML output
Sometimes pixels are the wrong abstraction—you want the fully hydrated markup after JavaScript runs, or a frozen snapshot for diffing. Setting output: "html" returns the document source from the controlled browser context.
Overview
HTML responses are still subject to the same authentication, quota, and validation rules as images. Because HTML can contain scripts, our gateway sets Content-Disposition: attachment with filename capture.html so browsers save the file instead of rendering it inline from the API origin—reducing the risk of confused-deputy XSS or phishing flows if someone shares a capture link.
Request shape
{
"url": "https://example.com/article",
"output": "html",
"wait_until": "networkidle"
}curl -X POST "https://screennabster.com/api/v1/capture" \
-H "X-API-Key: pk_live_…" \
-H "Content-Type: application/json" \
-d "{\"url\":\"https://example.com\",\"output\":\"html\"}" \
-o snapshot.htmlResponse headers
Expect Content-Type: text/html; charset=utf-8 (or equivalent) plus X-ScreenNabster-Duration. Treat the body as untrusted when you re-parse it inside your systems—sanitize before displaying to operators.
Use cases
- Archiving the DOM state of a complex SPA after user-specific data loads.
- Feeding HTML into downstream accessibility or SEO analyzers that need the rendered tree.
- Debugging layout issues by diffing captures across deployments.
Compared to fetching the URL yourself
A plain HTTP GET from your server only sees the initial HTML. ScreenNabster evaluates JavaScript, applies inject_css / inject_js, respects device emulation, and honors the same wait helpers as raster captures—see the performance guide for tuning.