15

Although it’s still a working draft, Web Notifications have been somewhat stable for quite a while now. In fact, they are stable enough that they exist unprefixed in current versions of Firefox, Chrome and Safari. As for the first two, they have been for quite a while already.

Yet, in chat, the option “enable desktop notifications” only appears in WebKit browsers because the code checks explicitely for the prefixed window.webkitNotifications, making it not work in other browsers that support them.

I would suggest you to do something like this somewhere:

if (!window.Notification) {
    window.Notification = window.webkitNotification || window.mozNotification || window.oNotification || window.msNotification;
}

And then just use the standardized, unprefixed window.Notification.

2
3

Your code suggestion wouldn't have worked as easily, because those implementations weren't compatible; you couldn't just replace them with each other. Your point stands however, and is now completed: We're now using the standard (if only working draft) version that's supported in Chrome, FF, Safari 6, and Opera 25 (the next version).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .