Desktop PWA works with Discourse!

Per Hands-On with Microsoft's New Edge Browser Built on Chromium - Thurrott.com

When it comes to features, Edge has the one critical item that always kept me crawling back to Chrome. If you are on a webpage, you can easily turn it into an app, by clicking the three dots in the top right and clicking install app. This is huge, as it allows me to turn Google Calendar, Tweetdeck, and a few other pages into applications on my desktop that makes my workflow, a lot easier.

:thinking: we should definitely whitelist all Chrome based browsers @falco

8 Likes

Looks like Chrome Canary is experimenting with a more in your face install button:

Here is it in Meta when the service worker is working:

13 Likes

Niiiice. We should definitely get this working on Chrome. I like it.

6 Likes

We want to get this working, but the last time we tried with the ā€œYou are offlineā€ page wasnā€™t a great experience. Also we had a lot of suggestions about making reading Discourse possible when you are offline.

Using some libraries from https://github.com/GoogleChrome/workbox I was able to:

  • Remove the ā€œYou are offlineā€ page

  • Make Discourse fallback to cache when a network request fail aka Discourse will allow offline browsing of every previously visited page.

  • Get a perfect score in the PWA Lighthouse audit:

  • Get the ā€œInstall Siteā€ on the Desktop working (availiable in Chrome canary for now, will land in stable around August)

Technical Details

The changes are pending in this branch: https://github.com/discourse/discourse/compare/offline

A demo site is running at https://discourse-workbox.muito.ninja/

27 Likes

Here is a demo of Discourse offline browsing on iPad

14 Likes

Can you create topics offline that get synced with the server when the device is back online?

The current changes only affect GET requests, so it will make you able to use the composer, if you ever did it while online.

Discourse already keeps submitting a topic in a persistent ā€œSavingā€ blue bar, and this doesnā€™t touch that request, so it should keep the current behavior.

However, getting Discourse to work totally in write mode while offline would require a lot more work and be a long term project involving multiple people. That is not the scope here, which is just enabling installs in Desktop.

9 Likes

cc @falco

In Chrome 76, weā€™re making it easier for users to install Progressive Web Apps on the desktop by adding an install button to the omnibox.

16 Likes

Okay, this is live in Meta for testing now. Please report any crazyness.

Here is Meta install:

6 Likes

Is there a flag we can set to tinker with this on our own installations?

4 Likes

Itā€™s in the same branch as always here. You could deploy from that branch but it is a lot behind master currently. I can rebase it to master, but I donā€™t recommend messing with this until itā€™s proven stable here.

Another cool thing, if you try to use the pwa with a cold cache:

13 Likes

This is live on latest Discourse tests-passed.

Please report any #bug in new topics.

12 Likes

Chrome 76 was launched yesterday with the Install call to action in the omnibar, and latest Discourse works with it out of the box.

15 Likes

Confirmed working in Chrome 76 released today, thereā€™s even a fairly complex animation in the address bar :exclamation: which calls attention to it.

Looks like the animation only happens once per domain though.

This is technically shipped but I still view it as rather experimental so I am re-opening the topic.

11 Likes

Is there a way to dismiss the icon in the address bar, either from Discourse or from Chrome? I prefer to just use the browser, so I donā€™t see the point in having that icon visible forever.

Probably a question better directed towards the Chrome browser developers, not us.

7 Likes

Iā€™ve been googling around on the Chrome side, but couldnā€™t find anything. So I guess Iā€™ll ask them.

Is this something that could theoretically be dismissable (e.g. with localstorage) or hidden permanently based on a Discourse setting? Iā€™m asking because I donā€™t know if Chrome automatically detects if the website is compatible as a PWA or if thereā€™s some flexibility on your end to only offer the option conditionally.

For anyone else interested, thereā€™s a setting in chrome://flags called App Banners which you can set to Disabled to remove the icon in the address bar.

EDIT: Actually, the relevant setting seems to be Desktop PWAs installable from the omnibox.

7 Likes

Just for information, today on Chrome on linux (Ubuntu) I even had a popup to propose me to ā€œinstallā€ discourse as an app. Something similar to the popups when websites ask to allow notifications.

Is Chrome trying to push for these kind of ā€œinstallationsā€ ?

A popup in desktop!?

Do you have a screenshot?

4 Likes