Skip to content Skip to sidebar Skip to footer

How To Add Support For HTML5 Notifications In XAML Webview In A UWP App?

So I am using a WebView in my UWP application and I would like to handle HTML5 notifications. What I did was to add support for the ScriptNotify event to my webview (here). MyWeb

Solution 1:

I found a new solution that might help you.

A notification request is initiated when the page loads, WebView can intercept it, using the event PermissionRequested.

private void WebView_PermissionRequested(WebView sender, WebViewPermissionRequestedEventArgs args)
{
    if (args.PermissionRequest.PermissionType == WebViewPermissionType.WebNotifications)
    {
        args.PermissionRequest.Allow();
    }
}

You can also pop up a window when you listen for a request, letting the user choose whether to accept the notification.

Best regards.


Post a Comment for "How To Add Support For HTML5 Notifications In XAML Webview In A UWP App?"