CrawlioCrawlio Docs

Viewport Commands

Viewport commands render a page at a specific screen size and device profile, then capture a PNG screenshot and the full rendered HTML. Each preset carries a CSS-pixel viewport, device pixel ratio, and (for mobile/tablet) a device-appropriate user-agent string. The captured artifacts are saved to the project folder alongside a JSON metadata sidecar.

All five viewport commands are Core tier.


/mobile <url>

Capture with an iPhone 14-class viewport and Mobile Safari user-agent.

Property Value
Width 390 px
Height 844 px
Device pixel ratio 3.0
User-Agent Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1

The UA override causes the server to send mobile-specific markup and @media queries fire at the mobile breakpoint.

Output

Field Type Description
png Data? PNG screenshot of the rendered page
html String Full rendered DOM snapshot
finalURL URL Final URL after redirects
title String? Page <title> if present
detectedFramework String? Primary framework detected during render
preset ViewportPreset The viewport configuration used

CLI

crawlio cmd mobile https://stripe.com

MCP

{ "name": "slash_mobile", "arguments": { "url": "https://stripe.com" } }

Returns ViewportCaptureReport JSON with viewport.name: "mobile".


/tablet <url>

Capture with an iPad-class viewport and iPadOS Safari user-agent.

Property Value
Width 820 px
Height 1180 px
Device pixel ratio 2.0
User-Agent Mozilla/5.0 (iPad; CPU OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1

CLI

crawlio cmd tablet https://stripe.com

MCP

{ "name": "slash_tablet", "arguments": { "url": "https://stripe.com" } }

Returns ViewportCaptureReport JSON with viewport.name: "tablet".


/desktop <url>

Capture with a desktop-class viewport. The user-agent is not overridden (caller's default UA is preserved).

Property Value
Width 1440 px
Height 900 px
Device pixel ratio 1.0
User-Agent (caller default)

CLI

crawlio cmd desktop https://stripe.com

MCP

{ "name": "slash_desktop", "arguments": { "url": "https://stripe.com" } }

Returns ViewportCaptureReport JSON with viewport.name: "desktop".


Capture with a US Letter (8.5 x 11 in at 96 DPI) viewport and print stylesheet emulation. A JS bridge shims matchMedia('print') to always match, so CSS @media print rules apply and the resulting PNG reflects the print layout.

Property Value
Width 816 px
Height 1056 px
Device pixel ratio 2.0
User-Agent (caller default)
emulatePrint true

The emulatePrint flag is injected as a user script at .atDocumentStart. It forces window.matchMedia('print').matches to return true before the page's CSS is evaluated.

CLI

crawlio cmd print https://example.com/pricing

MCP

{ "name": "slash_print", "arguments": { "url": "https://example.com/pricing" } }

Returns ViewportCaptureReport JSON with viewport.name: "print".


/viewport <WxH> <url>

Capture with a custom viewport size. Width and height are specified as WxH (e.g. 830x360). Both dimensions are clamped to a minimum of 1 CSS pixel by the ViewportPreset initializer.

Property Value
Width user-specified
Height user-specified
Device pixel ratio 1.0
User-Agent (caller default)

CLI

crawlio cmd viewport 830x360 https://example.com

MCP

{ "name": "slash_viewport", "arguments": { "url": "https://example.com", "width": 830, "height": 360 } }

Returns ViewportCaptureReport JSON with viewport.name: "custom".


Sidecar report

All viewport commands write a JSON sidecar to the project folder as viewport-{name}-{host}-{epoch}.json:

Field Type Description
url String Requested URL
finalURL String Final URL after redirects
capturedAt Date ISO 8601 timestamp
viewport ViewportPreset Full preset (name, width, height, devicePixelRatio, userAgent, emulatePrint)
title String? Page title
htmlLength Int Character count of captured HTML
screenshotPath String? Path to the PNG artifact
htmlPath String? Path to the HTML artifact
detectedFramework String? Primary framework detected during render
© 2026 Crawlio. All rights reserved.