setUserAgentOverride method

Future<void> setUserAgentOverride(
  1. String userAgent, {
  2. String? acceptLanguage,
  3. String? platform,
  4. UserAgentMetadata? userAgentMetadata,
})

Allows overriding user agent with the given string. userAgentMetadata must be set for Client Hint headers to be sent. userAgent User agent to use. acceptLanguage Browser language to emulate. platform The platform navigator.platform should return. userAgentMetadata To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData

Implementation

Future<void> setUserAgentOverride(
  String userAgent, {
  String? acceptLanguage,
  String? platform,
  UserAgentMetadata? userAgentMetadata,
}) async {
  await _client.send('Emulation.setUserAgentOverride', {
    'userAgent': userAgent,
    if (acceptLanguage != null) 'acceptLanguage': acceptLanguage,
    if (platform != null) 'platform': platform,
    if (userAgentMetadata != null) 'userAgentMetadata': userAgentMetadata,
  });
}