ScreenshotNeo

BlogHow-to

How to Capture a Mobile Website Screenshot with a Custom User Agent on iPhone

Use Safari Web Inspector on a Mac to set a custom user agent for an iPhone page, then capture the result on the phone itself.

By the ScreenshotNeo team4 October 20265 min read

To capture a mobile website screenshot with a custom user agent on an iPhone, use Safari’s remote Web Inspector on a Mac to set the user agent for the page running on the iPhone. After the page reloads, take the screenshot on the iPhone itself. A user-agent setting in Mac Safari changes the Mac page, not the remotely inspected iPhone page.

What you need

  • An iPhone and a Mac running Safari.
  • The page open in Safari on the iPhone.
  • A physical cable connecting the phone to the Mac, or wireless debugging configured in Xcode.
  • Web Inspector enabled on the iPhone and on the Mac.

This workflow inspects a page running on the physical iPhone. It is different from viewing a responsive layout on the Mac or in a simulator.

Set a custom user agent and capture the iPhone page

  1. Enable Web Inspector on iPhone. Open Settings, go to Safari > Advanced, and turn on Web Inspector.
  2. Connect the phone. Connect it to the Mac with a cable, or configure wireless debugging in Xcode. Enable Web Inspector in Safari on the Mac if it is not already enabled.
  3. Open the remote page inspector. In Mac Safari, open Develop, select the connected iPhone, and choose the page open on the phone. Make sure you select the page under the iPhone, rather than a page running in Mac Safari.
  4. Choose the user agent for that page. In the remote Web Inspector’s device settings menu, choose a preset or select Other… and enter the custom user-agent string.
  5. Wait for the reload. Changing the setting reloads the inspected page. Check the reloaded page on the iPhone and confirm it shows the content you expect.
  6. Take the screenshot on iPhone. Use the iPhone’s screenshot control after confirming the page. Button combinations and full-page screenshot availability depend on the device and software version; consult Apple’s current iPhone instructions for your model.

The remote setting applies to the inspected page and can remain in effect while you navigate as long as the inspector stays open and connected. It resets when the inspection session closes or the device disconnects.

Choose a connection and user-agent option

Choice Use it when Consideration
Physical cable You want a direct connection to the Mac. Connector compatibility depends on your iPhone and Mac.
Wireless debugging You have configured the device connection in Xcode. It requires that setup before the iPhone appears for remote inspection.
Preset user agent You need one of the presets available in the remote inspector. Confirm the selected preset is the one needed for the page.
Custom string You need a specific user-agent value. A user-agent override changes the reported string; it does not reproduce every capability or behavior of another device.

What a user-agent override does and does not do

A user agent is a string the browser sends to identify itself. A site may use it when deciding which content to serve. Overriding it can help debug user-agent-dependent behavior, but it does not turn the iPhone into a different phone or browser. Screen dimensions, supported features, rendering behavior, and other device properties remain those of the actual iPhone and browser.

Apple recommends using feature detection to enable or disable functionality instead of relying on browser names or versions in the user-agent string. If you maintain the website, test the feature itself where possible instead of treating a particular string as proof that the feature exists.

Troubleshooting

Symptom Likely cause Fix
The iPhone does not appear in Safari’s Develop menu. Web Inspector is off on the phone or Mac, or the connection is not established. Enable Web Inspector on both devices, reconnect by cable, or check the Xcode wireless-debugging setup.
The page does not appear under the iPhone. The page is not open in iPhone Safari, or the wrong Develop-menu target was selected. Open the page on the phone and choose that page beneath the connected iPhone in Develop.
The website still behaves as before. The page may not have reloaded, or the site may not use the user agent to select that behavior. Wait for the reload and inspect the result. Check the site’s behavior and feature support rather than assuming the user-agent string controls it.
The custom setting disappears. The inspector session closed or the device disconnected. Reconnect, reopen the page inspector, and set the user agent again.
Mac Safari shows a different result than the iPhone. The Mac’s own user-agent setting affects its page, not the remote iPhone target. Set the user agent in the remote inspector opened from the iPhone’s Develop-menu entry.
The page changed but the screenshot is not the expected size or layout. A user-agent override does not change the physical viewport or emulate all device properties. Capture on the actual iPhone for its real viewport, or use a purpose-built capture setup when you need a controlled viewport.

Performance, reliability, and cost

The remote-inspection method has no screenshot-service charge, but it requires an available Mac, an iPhone connection, and a manual capture. A cable is optional if wireless debugging is configured. Keep the inspector open through navigation if you need the override to persist. For repeatable captures across many URLs, a scripted capture service can reduce manual steps; verify that its user-agent option and viewport match your requirements.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its API can return a screenshot in PNG, JPEG, or WebP, or a PDF. For a mobile viewport, you can pass a device preset or viewport options, and configure a custom user agent. See the ScreenshotNeo API documentation for the available parameters.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

These are runnable request examples; add the documented device-preset or viewport and custom-user-agent parameters for your target capture. ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before capture, and those steps can be turned off. Bot checks, blank pages, and failed loads are never billed; response headers report the page verdict and billing status. Its MCP server lets AI agents use screenshot tools. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000 screenshots.

Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card.

FAQ

Can I change the user agent directly in iPhone Safari settings?

The workflow described here sets a per-page user agent through remote Web Inspector on a Mac. The dossier does not establish a native iPhone Safari setting for entering an arbitrary user-agent string.

Will the remote override survive closing Web Inspector?

No. It can persist while the inspector remains open and connected, but resets when the session closes or the device disconnects.

Does a custom user agent make the iPhone behave exactly like another device?

No. It changes the reported string, not the iPhone’s full set of hardware, browser, viewport, and feature characteristics.

Can I use this to take a full-page screenshot?

The available sources do not establish full-page capture steps or availability for every iPhone, browser, and software version. Check the current iPhone instructions for the device and page you are using.