Implement Badging API


(Rafael dos Santos Silva) #1

There is a new web API that allows installed web apps to show a icon to warn the user about pending notifications.

Explainer: badging/ at master · WICG/badging · GitHub

Currently, this is only available for websites who sign up to the trial, and only on Windows and Mac OS using Google Chrome. (Meta has this enabled on Light and Dark Themes).

This is how the looks on Windows:

Before a notification


After a notification


(Jeff Atwood) #2

Here’s how to test this in Windows on Chrome (latest version 73, just released today):

  • go to the three dots menu at the upper right in Chrome
  • select More Tools → Create Shortcut
  • tick the “Open as window” checkbox
  • select Create

Like so

I’ll try it out … it works!

Experimental Desktop PWA works with Discourse!
(David Taylor) #3

This is very cool! On mac, it’s the same process to install the app. Then when you launch it you get a super minimal PWA window:

And the notification badge in the dock:


(Sam Saffron) #4

The huge omission here is that there is no back/forward or reload button. Kind of wish we had some minimal responsive PWA panel that we add when we detect PWA cause you can figure this out this is going on from JavaScript.

Step 1 here of course is a theme component.

(Rafael dos Santos Silva) #5

You can also detect it from CSS, here is one thing I added as a theme-component to the Dark Theme here in Meta:

@media all and (display-mode: standalone) {
    //blink-based browsers (don't work on safari, which exposes a JS only API for this)
    ::-webkit-scrollbar {
        background: $secondary;
    ::-webkit-scrollbar-thumb {
        background: $header_primary-medium;
    ::-webkit-scrollbar-corner {
        background: $secondary;
    body {
        scrollbar-color: $header_primary-medium $secondary;