Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Click event on Google Notification

I am developing a google chrome extension for my website.

I want that when the user clicks on the desktop notification of google chrome, that my website opens.

So how can I handle the google chrome desktop notification click event?

like image 974
Kishan Gajjar Avatar asked Mar 22 '11 06:03

Kishan Gajjar


People also ask

Does clicking Yes on Google Calendar invite send a response?

Once you've selected "Yes," an email will be sent to the event's creator informing them of your answer, and if you have a Google account, the event will show up on your Google Calendar.

How do I make Google Calendar reminders pop up?

Open Google Calendar. Under “My Calendars,” check Reminders. In the pop-up box, click Reminder.

What are alert notifications on Google Calendar?

Notifications allow users to find out about changes to events in their calendar.


1 Answers

If you don't want to use an HTML notification, you can add a click event handler to the notification and call the "cancel" function.

var notification = window.webkitNotifications.createNotification(
        'url', 'title', 'text');

notification.addEventListener('click', function() {
    notification.cancel();
    window.open('url')
})
notification.show();
like image 159
Sergio Prado Avatar answered Sep 20 '22 00:09

Sergio Prado