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).
MyWebView.ScriptNotify += WebView_Notify;
private void WebView_Notify(object sender, NotifyEventArgs e)
{
Debug.WriteLine("NOTIFIED " + e.Value);
}
Then using InvokeScriptAsync
I ran the following javascript code:
(function() {
var N = window.Notification;
window.external.notify(N.permission);
var P = function (title, options){
window.external.notify(title)
};
P.permission = 'granted';
N = P
})();
However, this does not work. In my debug output I do get:
"NOTIFIED default`
which means that ScriptNotify
handler is being triggered. However, how can implement HTML5 Notifications support in my app?