Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html5 showNotification

I have created a desktop notification with window.webkitNotifications.createNotification(). I've seen that gmail use an onclick event on the notification for the redirection, how is it made?

like image 883
Squall Avatar asked Jul 23 '26 23:07

Squall


1 Answers

i have found the solution:

var notification = window.webkitNotifications.createNotification(url,title,teaser); 
notification.onclick = function(x) { window.focus(); this.cancel(); $(location).attr('href',path);};
notification.show();
like image 172
Squall Avatar answered Jul 28 '26 15:07

Squall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!