Today I was reviewing my HTML5 API demos repository to keep its information updated and relevant. In the last two weeks Google has released Chrome 38, Opera has released Opera 25, and Mozilla has released Firefox 33. Every time a new version of a browser is available, it may introduce support for new APIs or change an already supported API to accommodate changes in the specifications. For these reasons, a general check was much needed.

In this article I’ll discuss what’s the current state of the Web Notifications API, what browsers support it, and what versions of the specifications. I’ll use this post also to summarize some inconsistencies I’ve found along the way.

Introductory notes

First of all, if you’re reading this article and you need an introduction to the Web Notifications API, I suggest you to read my article An Introduction to the Web Notifications API.

The second important point is that the Web Notifications API have two specifications: the W3C specifications and the WHATWG specifications. The last version of the W3C specifications dates back to latter is more the 12 September 2013, while the last update of the WHATWG specifications was made the 12 October 2014. The freshness of the last update isn’t the only difference and I’ll highlight some of them in the remainder of this article.

Thanks to Anne van Kesteren, now I have an even better understanding on what’s going on in regard of the Web Notifications API and the WHATWG specifications, so I’ve updated this article. The main point I discovered is that only very recently the WHATWG specifications have dropped the onclose and the onshow event.

As a final note, all the assertions I’ll made are based on my tests using the demo page I’ve build for HTML5 API demos.

With these brief notes in mind, let’s now go back to the main topic. Please note that I will not cover Safari because I don’t (and will never) have a Mac.

Chrome 38

At the moment it’s hard to say for me if Chrome implements the W3C or the WHATWG specifications. My understanding is that up to Chrome 37, the browser supported the W3C specifications, and starting from version 38 it supports the WHATWG specifications. However, because I’m analyzing only the last version of every browser, I’ll focus on Chrome 38 and its adherence to the WHATWG specifications. Said that, I see the following issues:

  • Chrome exposes four properties to manage events (onclick, onclose, onerror, onshow) but the WHATWG specifications now only define two (onclick, onerror). Because this is a very recent change in the specifications, you can expect a change in the next version of Chrome.
  • Chrome doesn’t expose a data property

Although Chrome 38 still exposes onclose, it’s the only browser to not fire the close event, which seems correct to me.

Opera 25

Based on the release post of Opera 25, this browser implements the WHATWG version of the Web Notifications API. Based on this assertion, I see the following issues:

  • Opera exposes four properties to manage events (onclick, onclose, onerror, onshow) but the WHATWG specifications only define two (onclick, onerror).
  • Opera is able to fire the show event, that thus can be used to execute a function
  • Opera doesn’t expose a data property

Not related with the specifications, but Opera 25 is the only browser that doesn’t show the icon of a notification if the format used is .ico (I’ve filed an issue whose ID is DNA-28523).

Firefox 33

Based on this tweet by Anne van Kesteren, Firefox implements the WHATWG version of the API. Because of this, I see the following issues:

  • Firefox exposes four properties to manage events (onclick, onclose, onerror, onshow) but the current WHATWG specifications only define two (onclick, onerror)
  • Firefox is able to fire the show event, that thus can be used to execute a function
  • Firefox doesn’t expose a data property

Not related to the specifications, but the documentation page of the Notification object on MDN and a page titled Using Web Notifications that explain how to use the Web Notifications API describe and even link to the W3C specifications. It also erroneously asserts that Firefox is the only browser to support the title attribute. Anne van Kesteren wrote me that he has informed the people managing the Mozilla developer network, so you can expect the documentation to be updated soon.

Conclusions

In this short article I tried to give an overview of the current state of the Web Notifications API and its support among the most used and modern browsers. I’ve also highlighted what I think are inconsistencies with the current version of specifications. As I’ve learned, most of these inconsistencies are due to the very recent update of the specifications, so you can expect a change in the implementation of this API in the next release of the browsers discussed.

The State of the Web Notifications API
Tagged on: