Compartilhar via


CoreWebView2Profile.SetPermissionStateAsync Method

Definition

Sets permission state for the given permission kind and origin asynchronously.

public System.Threading.Tasks.Task SetPermissionStateAsync (Microsoft.Web.WebView2.Core.CoreWebView2PermissionKind PermissionKind, string origin, Microsoft.Web.WebView2.Core.CoreWebView2PermissionState State);
member this.SetPermissionStateAsync : Microsoft.Web.WebView2.Core.CoreWebView2PermissionKind * string * Microsoft.Web.WebView2.Core.CoreWebView2PermissionState -> System.Threading.Tasks.Task
Public Function SetPermissionStateAsync (PermissionKind As CoreWebView2PermissionKind, origin As String, State As CoreWebView2PermissionState) As Task

Parameters

origin
String

Returns

Remarks

The state change persists across sessions until it is changed by another call to SetPermissionState, or by setting the State property in PermissionRequestedEventArgs. Setting the state to @CoreWebView2PermissionState$.Default will erase any state saved in the profile and restore the default behavior. The origin should have a valid scheme and host (e.g. "https://www.example.com"), otherwise the method fails. Additional URI parts like path and fragment are ignored. For example, "https://wwww.example.com/app1/index.html/" is treated the same as "https://wwww.example.com". See the MDN origin definition for more details.

Applies to