Jaa


WebView.PermissionRequested Event

Definition

Occurs when an action in a WebView requires that permission be granted.

// Register
event_token PermissionRequested(TypedEventHandler<WebView, WebViewPermissionRequestedEventArgs const&> const& handler) const;

// Revoke with event_token
void PermissionRequested(event_token const* cookie) const;

// Revoke with event_revoker
WebView::PermissionRequested_revoker PermissionRequested(auto_revoke_t, TypedEventHandler<WebView, WebViewPermissionRequestedEventArgs const&> const& handler) const;
public event TypedEventHandler<WebView,WebViewPermissionRequestedEventArgs> PermissionRequested;
function onPermissionRequested(eventArgs) { /* Your code */ }
webView.addEventListener("permissionrequested", onPermissionRequested);
webView.removeEventListener("permissionrequested", onPermissionRequested);
- or -
webView.onpermissionrequested = onPermissionRequested;
Public Custom Event PermissionRequested As TypedEventHandler(Of WebView, WebViewPermissionRequestedEventArgs) 

Event Type

Remarks

The types of permission that can be requested are defined in the WebViewPermissionType enumeration.

If you don't handle the PermissionRequested event, the WebView denies permission by default.

When you handle a permission request in a WebView, you get a WebViewPermissionRequest object as the value of the WebViewPermissionRequestedEventArgs.PermissionRequest property. You can call Allow to grant the request, Deny to deny the request, or Defer to defer the request until a later time. For example, you might defer the request if you need to prompt the user for consent.

When you defer a WebViewPermissionRequest, a new WebViewDeferredPermissionRequest is created with the same Id and added to the DeferredPermissionRequests collection. When you are ready to act on the request, call the DeferredPermissionRequestById method and pass the Id of the deferred request. After you retrieve the request, you can call the Allow method to grant the request, or call the Deny method to deny the request.

Applies to

See also