A mobile screenshot in headless Chrome is made of five separate settings, and each one changes something different. The viewport width decides which CSS layout the page uses. The device pixel ratio only decides how many pixels the image has. isMobile makes Chrome obey the page's viewport meta tag. hasTouch switches the touch media queries and events. The user agent changes what the server sends back, and setting only the string quietly breaks client hints. Change just one and you get a screenshot that is neither desktop nor mobile.
We tested this by changing one setting at a time on a probe page and on five real sites. Below are the results, three captures that show the failures, and a short Puppeteer script that sets all five consistently.
How we tested
On 21 October 2026 we served a small probe page from a local Node server. The page reports what the browser tells it: innerWidth, devicePixelRatio, screen.width, whether (max-width: 600px) and (pointer: coarse) match, navigator.maxTouchPoints, the user agent string and navigator.userAgentData.mobile. The server records the User-Agent and Sec-CH-UA-Mobile request headers it received. We served the page twice, once with <meta name="viewport" content="width=device-width, initial-scale=1"> and once without it.
The baseline was Puppeteer's desktop default: a 1280 × 800 viewport, deviceScaleFactor 1, isMobile and hasTouch false, and Chrome's own user agent. From there we changed one setting at a time, using the values from Puppeteer's built-in "iPhone 15 Pro" preset: a 393 × 659 viewport, deviceScaleFactor 3, isMobile and hasTouch true, and an iPhone Safari user agent string. Each run used a fresh browser context.
We ran the probe on three combinations: Puppeteer 24.11.1 with its bundled Chrome 138, Puppeteer 24.11.1 with Chrome 156, and Puppeteer 25.15.0 (the current release) with Chrome 156. All three gave identical values. Then we loaded five real pages with the same settings on Chrome 156: the first web page at info.cern.ch, Hacker News, GOV.UK, Bing and YouTube.
What each setting changes
Results from the probe page with the viewport meta tag. "Narrow CSS" means the (max-width: 600px) media query matched.
| Changed alone | Image size | innerWidth | Narrow CSS | Touch (pointer: coarse) | UA string says mobile | Sec-CH-UA-Mobile sent | userAgentData.mobile |
|---|
| Nothing (desktop) | 1280 × 800 | 1280 | no | no | no | ?0 | false |
deviceScaleFactor: 3 | 3840 × 2400 | 1280 | no | no | no | ?0 | false |
| Viewport 393 × 659 | 393 × 659 | 393 | yes | no | no | ?0 | false |
| iPhone user agent string | 1280 × 800 | 1280 | no | no | yes | not sent | false |
isMobile: true | 1280 × 800 | 1280 | no | no | no | ?0 | false |
hasTouch: true | 1280 × 800 | 1280 | no | yes | no | ?0 | false |
| Android UA with metadata | 1280 × 800 | 1280 | no | no | yes | ?1 | true |
Four things stand out.
The device pixel ratio changes the image, not the page. At deviceScaleFactor 3 the page still had a 1280-pixel layout and matched the same media queries; only devicePixelRatio and the image size changed. MDN defines the ratio as the number of physical pixels used to draw one CSS pixel, which is exactly what we saw: three times the width, three times the height, nine times the pixels. The PNGs grew less than ninefold. On four of the real pages they were 3.45 to 3.87 times larger; Bing, whose viewport is mostly a photograph, grew 5.6 times.

The viewport width is what switches the layout. Shrinking the viewport to 393 pixels was the only single change that made the narrow CSS apply. That is why a "mobile" screenshot taken at 1280 pixels wide with a phone user agent still shows the desktop design.
isMobile alone did nothing visible on a 1280-pixel viewport, apart from screen.width changing from 800 to 1280. Its effect appears when the page has no viewport meta tag, covered below. The Chrome DevTools Protocol describes the flag as emulating a mobile device, including the viewport meta tag, overlay scrollbars and text autosizing. In Puppeteer it does not turn on touch: maxTouchPoints stayed 0 until we set hasTouch. Playwright's documentation describes its own isMobile as covering both the meta tag and touch events, so the two libraries split the work differently.
Setting only the user agent string breaks client hints. With the iPhone string set through page.setUserAgent(), the server got an iPhone User-Agent header but no Sec-CH-UA-Mobile header at all, and navigator.userAgentData.mobile stayed false. Without an override, Chrome sent ?0. MDN describes Sec-CH-UA-Mobile as a low-entropy hint that is sent by default, without the server asking for it. A site that reads client hints rather than the string sees a browser that claims to be an iPhone in one place and says nothing in the other. Passing user agent metadata as the second argument fixed it: the header became ?1 and userAgentData.mobile became true. The DevTools Protocol's setUserAgentOverride documents that metadata as what is "sent in Sec-CH-UA-* headers and returned in navigator.userAgentData".
The viewport meta tag and isMobile
Most current sites declare width=device-width, so for them isMobile changes little. Pages without the tag are different. MDN explains that mobile browsers render such pages on a wider virtual viewport, giving 980 pixels as an example, and then shrink the result to fit the screen.
Chrome did exactly that. On our probe page without the meta tag, a 393-pixel viewport alone gave an innerWidth of 393 and the narrow layout. Adding isMobile changed innerWidth to 980, the narrow CSS stopped matching, and the screenshot showed a desktop-width page scaled down to a third of its size. The first web page at CERN, which has no viewport tag, behaved the same: its layout grew from 393 to 980 pixels wide and its text became tiny.

The small version is the accurate one. It is what a phone shows for that page. If you only set the viewport, you get a screenshot no phone would produce.
The same flag can also zoom out pages that do have the tag. Bing declares a viewport, but at 393 pixels its layout was still 768 pixels wide and overflowed to the right. With only the viewport set, the screenshot cut that layout off at the right edge. With isMobile and hasTouch added, Chrome zoomed out until the 768-pixel layout fitted, which MDN notes browsers may do when content overflows. The hero image at the top of this article shows all three steps.
What the user agent changes
The user agent is the only setting the server sees before it sends any HTML, so it decides which page you get at all. Two of our five sites served something different:
| Site | Viewport, isMobile and hasTouch set, desktop UA | Same plus iPhone UA |
|---|
| YouTube | www.youtube.com, 1,284,704 characters of rendered HTML | redirected to m.youtube.com, 516,505 characters |
| Bing | desktop page zoomed out to 768 pixels wide | mobile page laid out at 393 pixels |
| GOV.UK, Hacker News, CERN | same page | same page |
GOV.UK and Hacker News served the same HTML to every user agent and adapted with CSS alone, so for them the viewport did all the work. For YouTube and Bing, a correctly sized viewport without a phone user agent gave a page that no phone ever receives.
The user agent has a cost in the other direction too. Setting only the iPhone string on a 1280-pixel viewport sent YouTube's mobile site into a desktop-sized window. Puppeteer's presets also carry fixed strings that age: the "Pixel 5" preset in Puppeteer 24.11.1 identifies as Chrome 99, and "iPhone 15 Pro" as iOS 17.5.
A mobile screenshot with all five settings
This script sets the viewport, device pixel ratio, isMobile, hasTouch and user agent with page.emulate(), then adds the client hint metadata that emulate() leaves out. We ran it with Puppeteer 24.11.1 and with Puppeteer 25.15.0 against Chrome 156. Puppeteer 25 documents the two-argument form of setUserAgent() as obsolete in favour of an options object, but it still works.
import puppeteer, { KnownDevices } from "puppeteer";
const device = KnownDevices["Pixel 5"];
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.emulate(device);
await page.setUserAgent(device.userAgent, {
platform: "Android",
platformVersion: "11",
architecture: "",
model: "Pixel 5",
mobile: true,
});
await page.goto("https://www.bing.com/", { waitUntil: "networkidle2" });
console.log(
await page.evaluate(() => ({
layoutWidth: innerWidth,
dpr: devicePixelRatio,
touch: matchMedia("(pointer: coarse)").matches,
uaDataMobile: navigator.userAgentData?.mobile,
})),
);
await page.screenshot({ path: "bing-pixel5.png" });
await browser.close();
Output on both versions:
{ layoutWidth: 393, dpr: 3, touch: true, uaDataMobile: true }
The image was 1179 × 2553 pixels: the preset's 393 × 851 viewport times 3. We chose an Android preset on purpose. MDN's compatibility data lists neither Sec-CH-UA-Mobile nor navigator.userAgentData as supported in Safari on iOS, so pairing an iPhone string with Chrome's client hints creates a combination no real device has.
Which settings to change for which job
| You want | Change |
|---|
| A sharper or larger image of the same layout | deviceScaleFactor only |
| The page's responsive layout at a phone width | viewport, plus isMobile for pages without a viewport tag |
| Touch-only menus and controls | hasTouch |
| The page a phone actually receives | all of the above, plus the user agent string and its metadata |
Before trusting a mobile capture, check it from inside the page: innerWidth, devicePixelRatio, matchMedia("(pointer: coarse)") and navigator.userAgentData?.mobile should all agree with the device you meant to emulate. If one of them is off, the screenshot shows a page no phone would display.