Pages

dimanche 14 octobre 2012

HTML desktop notifications not working on Chrome 22

Starting from Chrome version 22, HTML desktop notifications do not seem to work anymore in webapp mode. The following error is thrown each time we execute the following code:

webkitNotifications.createHTMLNotification(notificationUrl);

TypeError: Object # has no method 'createHTMLNotification'

Note that chrome extension are still able to display HTML desktop notifications.

 In smshare we use HTML desktop notification to add behaviours to the notification allowing users to reply to the incoming SMS for example. Because of this issue in Chrome 22 we fell back to classic notification. Fortunately, it is possible to add an event listener on the notification and so we did.

var notificationOnClick = function(){
 notification.cancel(); 
 window.location = (some_where);
};

notification.addEventListener('click', notificationOnClick, false);

The issue was reported here. Vote too if you want a quick feedback on the issue.

Aucun commentaire:

Enregistrer un commentaire