Network & Downloads

Set User Agent

Override the browser's user agent string.

Override the browser's user agent string.

Overrides the browser's user agent string, including navigator.userAgent and the HTTP User-Agent header, for subsequent requests. Can be configured before the first GoTo so it is applied automatically on the next navigation, or applied immediately at runtime.

TIP

Passing an empty string clears the override, restoring the browser's default user agent.

Examples

GPAL Fluent: High-level fluent C# API

//Browser setup and settings before the first GoTo or Get; applied automatically on the next navigation.

browser.WithUseUserAgent(string userAgent);

MagicHelper: MagicHelper utility library

GPAL.MagicHelper.SetUserAgent(string userAgent);

Puppeteer Client: Puppeteer-style C# client

browser.PuppeteerClient.SetUserAgent(string userAgent).Execute();

Puppeteer Communicator: Low-level communicator

await browser.PuppeteerCommunicator.SetUserAgent(string userAgent, string sessionId);

REST Client: Direct REST/HTTP client

GPAL.OttoMagicClient.SetUserAgent(string userAgent).Execute();