Native Numerical Notifications

Purpose

Desktop applications have the ability to set a Numerical Notification, frequently a white number on a round red background displayed in the corner of the application.

Workaround/Polyfill

It’s possible to change the favicon by using canvas, but browser icon will not show the number, and the favicon is not always visible in all browsers.

Example Usages

  • Count of new messages (this site has something like it at the top)
  • Number of people actively watching your video stream
  • New notifications
  • Error count

Constraints

  • Value must be a number or a character in the list that follows to avoid abuse of this feature.
  • Browser owners can decide if they want to show the notification on the tab, application icon, or both.
  • If multiple tabs have Numerical Notification then it is up to the browser to combine the values, such as adding them all up and showing a sum, letting the user decide which domain or tab to use.
  • The API could accept a foreground and background color, but it should be optional to support this because not all OS’s will allow that level of customization.

Valid values

  • 0-9
  • ?
  • !
  • … (three ellipses)
  • not an exhaustive list

TBD

  • Are permissions required before this feature can be used?
  • Can JS be used to read the value of the current tab’s Numerical Notification?
  • Can JS be used to read the value of the application’s Numerical Notification?
2 Likes

This makes a lot of sense to me.

There is a bunch of active discussion on notifications going on on the WHATWG list right now, which makes me think that vendors would be receptive to this sort of suggestion.

Although this forum is much, much more pleasant to use than that mailman list, I’m not sure we’ll get the right audience here. I’ll ping them on Twitter but if they don’t show up and start engaging, consider sending your own message to that list.

I like it. Not sure if this forum has quite the reach indeed. Might be best to bring this up on the list. I filed https://github.com/whatwg/notifications/issues/23 to keep track of this.

Thanks for your support @annevk and @domenic!

I added more detail to the original proposal and I’ll email the WHATWG list if I don’t see anything similar pop up.

dylang, any updates on the topic? I’m from Yandex. We have a browser that have implemented badge api but we would like to join a commonly used standard.

I think someone should outline use cases on the WHATWG list for this and perhaps an API proposal that satisfies them. I no longer think this should be part of the Notifications API.

I’ll write something for the WHATWG list.

@Mike_Tomshinsky I’m interested in what your badge api looks like, can you share a link to the docs?

It sounds like “badge” is more common name than “notifications” so I’ll use that word instead.

Can you change “Numerical Notifications” to “Badges” in the OP?

Sure. Here it is: http://api.yandex.com/tableau/doc/ Yes, notification is more about kind of push. Badge is more about a counter. Whatever it indicates: messages, updates, friend requests, cart items etc.

Let me know what you think