Table of Contents

Class CoreWebView2PermissionRequestedEventArgs

Namespace
Microsoft.Web.WebView2.Core
Assembly
Microsoft.Web.WebView2.Core.dll

Event args for the PermissionRequested event.

public class CoreWebView2PermissionRequestedEventArgs : EventArgs
Inheritance
CoreWebView2PermissionRequestedEventArgs
Inherited Members

Properties

Handled

The host may set this flag to TRUE to prevent the PermissionRequested event from firing on the CoreWebView2 as well.

public bool Handled { get; set; }

Property Value

bool

IsUserInitiated

true when the permission request was initiated through a user gesture such as clicking an anchor tag with target.

public bool IsUserInitiated { get; }

Property Value

bool

Remarks

Being initiated through a user gesture does not mean that user intended to access the associated resource.

PermissionKind

Gets the kind of the permission that is requested.

public CoreWebView2PermissionKind PermissionKind { get; }

Property Value

CoreWebView2PermissionKind

SavesInProfile

Set the SavesInProfile property to FALSE to not persist the state beyond the current request, and to continue to receive PermissionRequested events for this origin and permission kind.

public bool SavesInProfile { get; set; }

Property Value

bool

Remarks

The permission state set from the PermissionRequested event is saved in the profile by default; it is persisted across sessions and becomes the new default behavior for future PermissionRequested events. Browser heuristics can affect whether the event continues to be raised when the state is persisted.

State

Gets or sets the status of a permission request. For example, whether the request is granted.

public CoreWebView2PermissionState State { get; set; }

Property Value

CoreWebView2PermissionState

Remarks

The default value is Default.

Uri

Gets the origin of the web content that requests the permission.

public string Uri { get; }

Property Value

string

Methods

GetDeferral()

Gets a CoreWebView2Deferral object.

public CoreWebView2Deferral GetDeferral()

Returns

CoreWebView2Deferral

Remarks

Use the deferral object to make the permission decision at a later time. The deferral only applies to the current request, and does not prevent the PermissionRequested event from getting raised for new requests. However, for some permission kinds the WebView will avoid creating a new request if there is a pending request of the same kind.