October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk5 min

How to Change the User Agent in Headless Chrome

Set a user-agent override before navigation in Puppeteer, or edit it in Chrome DevTools. Learn the limits of string-only changes and when device emulation is needed.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In Puppeteer, set the user agent on the page before you navigate: call page.setUserAgent(), then page.goto(). For a manual test, use Chrome DevTools’ Network conditions panel to disable the browser default and enter a custom value. A user-agent override changes what a site is told about the browser; it does not turn Chrome into another browser or change Chrome’s internal behavior.

Change the user agent with Puppeteer

Set the override before navigation so the initial request uses it. Puppeteer’s current Page.setUserAgent(options) API accepts a configuration object with optional userAgent, userAgentMetadata, and platform fields.

As an Amazon Associate I earn from qualifying purchases.

Set a custom string

This runnable example launches Chrome in headless mode, applies a string override, navigates to the target, and prints the resulting page title. Install Puppeteer in your project first; replace the sample string and URL with values appropriate to your test.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const puppeteer = require('puppeteer');

(async () => {
  const browser = await puppeteer.launch({ headless: true });
  try {
    const page = await browser.newPage();

    await page.setUserAgent({
      userAgent: 'your target user-agent string'
    });
    await page.goto('https://example.com', { waitUntil: 'domcontentloaded' });

    console.log(await page.title());
  } finally {
    await browser.close();
  }
})();

Use a realistic value for the exact browser or device scenario you are testing rather than assuming any arbitrary string represents a complete browser emulation. Check the request and page-visible values after navigation.

#1 Best Overall
Samsung 14" Galaxy Chromebook Go Laptop PC Computer, Intel Celeron N4500 Processor, 4GB RAM, 64GB Storage, ChromeOS, XE340XDA-KA2US, Student Laptop, Silver
  • SLIM. LIGHTWEIGHT. READY TO GO: The all-new slim design is perfect for busy lives on the go.
  • SKILLFULLY DESIGNED. MILITARY TOUGH: Built with premium craftsmanship to withstand the occasional drop or ding.
  • ALL-DAY, ALL-IN-ONE CHARGING: Power through your school day – and beyond – with a long-lasting 12-hour battery.¹
  • 3X FASTER THAN THE PREVIOUS GENERATION OF WIFI: Crush your schoolwork in record time with Wi-Fi that’s three times faster than the previous generation of Wi-Fi.
  • YOUR PHONE AND CHROMEBOOK WORK BETTER TOGETHER: Easily transfer files between devices, and control your phone right from your Chromebook.

Include metadata or a platform when the test needs them

A site may inspect User-Agent Client Hints as well as the legacy user-agent string. If the intended scenario requires those signals to align, provide the corresponding metadata and platform fields supported by your Puppeteer version:

await page.setUserAgent({
  userAgent: 'your target user-agent string',
  userAgentMetadata: { /* values for the target scenario */ },
  platform: 'target platform'
});
await page.goto('https://example.com');

The object values depend on the scenario; do not copy generic metadata into a test without checking that it matches the browser and platform you mean to represent. Verify the outgoing request headers and values visible to page JavaScript in the actual browser and Puppeteer versions you run.

Rank #2
ASUS 2026 15" FHD IPS Chromebook, Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage, HDMI, Super-Fast WiFi, Chrome OS, Pastel Blue, Renewed
  • Intel Processor Up to 2.80GHz, 4GB DDR4, 128GB Storage
  • 15" FHD IPS Display, Intel UHD Graphics
  • 1x USB Type C, 1 x USB Type A, 1x Headphone/Microphone Combo Jack, HDMI
  • Super Fast WiFi and Bluetooth, Integrated Webcam
  • Chrome OS, AC Charger Included, Pastel Blue

Set a user agent manually in Chrome DevTools

  1. Open DevTools, then open Network conditions from the Network panel, or find Network conditions using the DevTools command menu.
  2. Under User agent, turn off Use browser default.
  3. Choose a preset or enter the custom user-agent string you want to test.
  4. If the test also depends on client hints, open the user-agent client hints controls, edit the values, and apply them.
  5. Reload the page, then inspect the request and the page’s behavior.

Chrome’s documented override changes how Chrome identifies itself to web servers and can affect the content served. It does not change how Chrome functions internally. DevTools controls the user-agent string and client-hints values separately, so changing one should not be assumed to update the other.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose between a string override and device emulation

Use a string override when the question is specifically how a site responds to a particular user-agent string. It does not reproduce another browser engine or, by itself, establish a device’s screen dimensions.

For a known device scenario, Puppeteer’s page.emulate(device) combines device metrics and a user agent. Emulate before navigation: a page may not expect its dimensions to change after it has loaded. Consider the intended device’s user agent, viewport, and relevant client hints together when deciding whether device emulation is a better fit than a string-only override.

What the override does—and what it does not

Current Chrome Headless mode shares the browser implementation with headful Chrome. The separate older implementation is available as chrome-headless-shell; it is not the ordinary current Headless mode. There is no special Headless-only user-agent setting in the documented workflow: configure the value through DevTools or the automation API.

Rank #4
HP Chromebook 14 Laptop, Intel Celeron N4120, 4 GB RAM, 64 GB eMMC, 14" HD Display, Chrome OS, Thin Design, 4K Graphics, Long Battery Life, Ash Gray Keyboard (14a-na0226nr, 2022, Mineral Silver)
  • FOR HOME, WORK, & SCHOOL – With an Intel processor, 14-inch display, custom-tuned stereo speakers, and long battery life, this Chromebook laptop lets you knock out any assignment or binge-watch your favorite shows..Voltage:5.0 volts
  • HD DISPLAY, PORTABLE DESIGN – See every bit of detail on this micro-edge, anti-glare, 14-inch HD (1366 x 768) display (1); easily take this thin and lightweight laptop PC from room to room, on trips, or in a backpack.
  • ALL-DAY PERFORMANCE – Reliably tackle all your assignments at once with the quad-core, Intel Celeron N4120—the perfect processor for performance, power consumption, and value (2).
  • 4K READY – Smoothly stream 4K content and play your favorite next-gen games with Intel UHD Graphics 600 (3) (4).
  • MEMORY AND STORAGE – Enjoy a boost to your system’s performance with 4 GB of RAM while saving more of your favorite memories with 64 GB of reliable flash-based eMMC storage (5).

A user-agent string is only one browser-identification signal. Sites can also use request headers such as Sec-CH-UA, Sec-CH-UA-Mobile, and Sec-CH-UA-Platform, or read navigator.userAgentData in JavaScript. A test that changes only the legacy string may therefore leave other signals inconsistent.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify the result and troubleshoot mismatches

  • The first request still has the original value: apply the override before page.goto() and then make a fresh navigation. Setting it after a page has already loaded does not change the request that has already happened.
  • The site still serves the same content: confirm that the site actually varies its response based on the signal you changed. It may rely on client hints, JavaScript-visible values, viewport dimensions, or other signals instead of the legacy string alone.
  • Request headers and JavaScript values disagree: inspect both the request and the values the page reads. Configure the relevant client-hints metadata when needed, and validate the behavior using the actual Chrome and Puppeteer versions in the test.
  • The site’s mobile layout does not appear: a user-agent string alone does not change viewport or device metrics. Use device emulation for a device-level test, and apply it before navigation.
  • The test results change between Headless environments: record whether the run uses current Chrome Headless or chrome-headless-shell; they are distinct implementations.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server. Its API accepts a custom user agent, which can help when you need a screenshot from a request configured for a particular user-agent scenario; it does not replace checking client hints or other browser signals required by a full compatibility test.

One GET request returns a screenshot or PDF. For example, capture a page using the API’s custom user-agent parameter:

curl -G "https://api.screenshotneo.com/v1/shot" 
  -d access_key=YOUR_API_KEY 
  --data-urlencode url=https://example.com 
  -d user_agent='your target user-agent string' 
  -o shot.webp

See the ScreenshotNeo API documentation for request parameters. Before capture, it accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents.

The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo and get 1,000 free screenshots a month with no card.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.