桌面版 PWA 现已支持 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 个赞

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 个赞

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

6 个赞

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 GitHub - GoogleChrome/workbox: 📦 Workbox: JavaScript libraries for Progressive Web Apps 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)

    image

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 个赞

Here is a demo of Discourse offline browsing on iPad

14 个赞

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 个赞

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 个赞

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

Here is Meta install:

6 个赞

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

4 个赞

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 个赞

此功能已在最新的 Discourse tests-passed 上上线。

请在新的主题中报告任何 #bug。

12 个赞

Chrome 76 已于昨日发布,地址栏中新增了“安装”行动号召按钮,而最新的 Discourse 版本可立即与其兼容。

15 个赞

确认在今天就发布的 Chrome 76 中已正常工作,地址栏中甚至有一个相当复杂的动画 :exclamation:,以引起注意。

不过看起来该动画每个域名只会触发一次。

虽然从技术上讲该功能已发布,但我仍将其视为相当实验性的,因此我重新开启了此话题。

11 个赞

有没有办法从 Discourse 或 Chrome 中隐藏地址栏中的图标?我更倾向于直接使用浏览器,所以觉得那个图标一直显示出来毫无意义。

这个问题可能更适合直接咨询 Chrome 浏览器开发者,而不是我们。

7 个赞

我在 Chrome 相关方面搜索了一番,但没找到相关信息,所以我想直接问问他们。

从理论上讲,这个提示是否可以通过(例如使用 localStorage)来关闭,或者根据 Discourse 的设置永久隐藏?我问这个是因为我不确定 Chrome 是否会自动检测网站是否兼容 PWA,或者你们这边是否有灵活性,可以仅在特定条件下提供该选项。

如果您也有兴趣,可以在 chrome://flags 中找到一个名为 App Banners 的设置,将其设置为 Disabled 即可移除地址栏中的图标。

编辑:实际上,相关的设置似乎是 Desktop PWAs installable from the omnibox

7 个赞

仅供知悉,今天在 Linux(Ubuntu)上的 Chrome 浏览器中,甚至弹出了一个提示,建议我“安装”Discourse 作为应用程序。这类似于网站请求允许发送通知时出现的弹窗。Chrome 是否正在推动这类“安装”?

桌面端弹出了窗口!?

你有截图吗?

4 个赞