14

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
  • Related, but I guess not a full duplicate: Can we make chat notifications work on Firefox? Commented Feb 4, 2014 at 21:56
  • @Arjan Interesting! I didn’t find that one. Commented Feb 4, 2014 at 22:36

1 Answer 1

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.