Introducing the Web Share API | Web | Google Developers

AI-generated summary

The Web Share API has been introduced to Discourse, allowing users to share content directly from the platform. Falco created a pull request to implement the API, which has been merged and is working on Chrome Android and iOS 12.2 Falco.

The native share sheet is used, and the “reply as linked topic” button is still accessible by tapping on the post’s time gerhard.

Users have requested support for sharing files to Discourse on all major operating systems, including Windows and macOS anon82467725. However, this would require implementing the V2 share target API, which allows uploads, and is a more complex task Falco.

Enabling the Web Share API on non-mobile devices is not recommended due to compatibility issues with certain browsers and operating systems Johani. Using Discourse’s own share sheet as a fallback for browsers that don’t support the Web Share API has been suggested Justin_Vega.

We can try switching the topic share icon action to the web share intent on supported platforms ( Chrome android for now)

19 „Gefällt mir“

Ok, did a quick try at this while I was in the plane and after some cleaning up sent a pull request.

Here is it in action:

16 „Gefällt mir“

This only happens on Android yes? Seems fairly safe to me then. @gerhard can you review?

1 „Gefällt mir“

It’s merged and it works great on Chrome 61. :+1:

8 „Gefällt mir“

I don’t have an android device to test, but I’m assuming this means users no longer have access to the “reply as linked topic” button that is normally next to the share buttons?

Can this functionality be put elsewhere? Or is there any way to add a custom button to the native share sheet?

11 „Gefällt mir“

It’s still there when you tap on the post’s time.

Only the share button uses the new functionality.

13 „Gefällt mir“

It works on iOS 12.2 :tada:

11 „Gefällt mir“

Ich würde gerne sehen, dass dies auf Chrome OS funktioniert. Discourse ist bereits eine PWA, also stehen die Sterne günstig.

Ich möchte auch Dinge AN Discourse teilen können. Wenn ich beispielsweise ein Bild auswähle, um es mit Discourse zu teilen, sollte ein neues Thema erstellt werden, bei dem das Bild oben eingefügt wird. Der Titel des Bildes würde dann als Thementitel verwendet.

Ich kenne auch viele Leute, die Windows nutzen, daher wäre Unterstützung für diese Plattform ebenfalls großartig. Sie möchten das native Menü verwenden. Es sieht sehr sauber aus.

Das Gleiche gilt für macOS, obwohl ich nicht sicher bin, wie die Umsetzung funktionieren würde.

TL;DR: Ich möchte Dateien AN Discourse auf allen wichtigen Betriebssystemen (sowohl mobil als auch Desktop) teilen können. Zusätzlich möchte ich Links VON Discourse auf allen wichtigen Desktop-Betriebssystemen teilen können. :slight_smile:

Unterstützen Firefox und Safari außerdem die Web Share API? Ursprünglich dachte ich, dass sie nur in Chromium-basierten Browsern unterstützt wird.

Dies funktioniert bereits seit Teilen in Discourse (über Android).

Derzeit setzen wir nur die V1 der API um, also nur Text. Die V2-Share-Target-API ermöglicht das Hochladen von Dateien, doch das ist etwas schwieriger umzusetzen. pr-welcome.

3 „Gefällt mir“

Es ist noch zu früh, dies auf Geräten außer Mobilgeräten zu aktivieren. Hier sind ein paar Beispiele:

  • Es funktioniert in Chrome nicht, wenn Sie kein Windows oder Chrome OS verwenden.
  • Es funktioniert in Edge nur, wenn Sie Windows verwenden.
  • Es funktioniert in Firefox unabhängig von Ihrem Betriebssystem nicht.

"web share" | Can I use... Support tables for HTML5, CSS3, etc

Ich sehe nicht, dass diese Probleme in absehbarer Zeit behoben werden.

6 „Gefällt mir“

Warum nicht den eigenen Share-Sheet von Discourse als Fallback verwenden, falls ein Browser die Web Share API nicht unterstützt?

Ach ja, die Web Share API ist auf iOS 14 immer noch kaputt. :slightly_frowning_face: