Share via


CoreWebView2Settings.UserAgent Property

Definition

Determines WebView2's User Agent.

public string UserAgent { get; set; }
member this.UserAgent : string with get, set
Public Property UserAgent As String

Property Value

Examples

WebViewSettings.UserAgent = dialog.Input.Text;

Remarks

The default value is the default User Agent of the Edge browser. This property may be overridden if the User-Agent header is set in a request. If the parameter is empty the User Agent will not be updated and the current User Agent will remain. Setting this property may clear User Agent Client Hints headers Sec-CH-UA-* and script values from navigator.userAgentData. Current implementation behavior is subject to change. The User Agent set will also be effective on service workers and shared workers associated with the WebView. If there are multiple WebViews associated with the same service worker or shared worker, the last User Agent set will be used.

Applies to