Html5 showNotification

I created a desktop notification with window.webkitNotifications.createNotification(). I saw that gmail uses the onclick event in the notification to redirect, how is this done?

+3
source share
1 answer

I found a solution:

var notification = window.webkitNotifications.createNotification(url,title,teaser); 
notification.onclick = function(x) { window.focus(); this.cancel(); $(location).attr('href',path);};
notification.show();
+4
source

Source: https://habr.com/ru/post/1792842/


All Articles