CoreWebView2PermissionRequestedEventArgs Class

Event args for the CoreWebView2.PermissionRequested event.

Summary

Members Description
Handled The host may set this flag to TRUE to prevent the PermissionRequested event from firing on the CoreWebView2 as well.
IsUserInitiated true when the permission request was initiated through a user gesture such as clicking an anchor tag with target.
PermissionKind Gets the kind of the permission that is requested.
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.
State Gets or sets the status of a permission request. For example, whether the request is granted.
Uri Gets the origin of the web content that requests the permission.
GetDeferral Gets a Deferral object.

Properties

Handled

bool Handled

The host may set this flag to TRUE to prevent the PermissionRequested event from firing on the CoreWebView2 as well. By default, both the PermissionRequested on the CoreWebView2Frame and CoreWebView2 will be fired.

IsUserInitiated

readonly bool IsUserInitiated

true when the permission request was initiated through a user gesture such as clicking an anchor tag with target. Being initiated through a user gesture does not mean that user intended to access the associated resource.

PermissionKind

readonly CoreWebView2PermissionKind PermissionKind

Gets the kind of the permission that is requested.

SavesInProfile

bool 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. 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

CoreWebView2PermissionState State

Gets or sets the status of a permission request. For example, whether the request is granted. The default value is CoreWebView2PermissionState.Default.

Uri

readonly string Uri

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

Methods

GetDeferral

Deferral GetDeferral()

Gets a Deferral object. 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.

Referenced by