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 Me gusta

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 Me gusta

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

1 me gusta

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

8 Me gusta

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 Me gusta

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

Only the share button uses the new functionality.

13 Me gusta

It works on iOS 12.2 :tada:

11 Me gusta

Me gustaría ver esto funcionando en Chrome OS. Discourse ya es una PWA, así que las cartas están alineadas.

También me gustaría poder compartir cosas CON Discourse. Por ejemplo, si selecciono una imagen para compartirla con Discourse, se crearía un nuevo tema con la imagen insertada en la parte superior. El título de la imagen se usaría como título del tema.

También conozco a mucha gente que usa Windows, así que el soporte para esa plataforma sería excelente. Quieren usar el menú nativo. Se ve muy limpio.

Lo mismo se puede decir de macOS, aunque no estoy muy seguro de cómo funcionaría la implementación.

TL;DR: Quiero poder compartir archivos CON Discourse en todos los sistemas operativos principales (tanto móviles como de escritorio). Además, me gustaría poder compartir enlaces DESDE Discourse en todos los sistemas operativos de escritorio principales. :slight_smile:

Además, ¿Firefox y Safari admiten la Web Share API? Originalmente pensé que solo era compatible con los navegadores Chromium.

Esto ya funciona gracias a Compartir en Discourse (vía Android).

Por ahora, solo implementamos la versión 1 de la API, por lo que solo se admite texto. La API de destino de compartir V2 permite la carga de archivos, pero es un poco más difícil de implementar. pr-welcome.

3 Me gusta

Aún es demasiado pronto para habilitar esto en dispositivos que no son móviles. Aquí tienes algunos ejemplos.

  • No funcionará en Chrome si no estás usando Windows o Chrome OS.
  • No funcionará en Edge a menos que estés usando Windows.
  • No funcionará en Firefox, independientemente del sistema operativo que uses.

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

No veo que esos problemas se solucionen pronto.

6 Me gusta

¿Por qué no usar el panel de compartir propio de Discourse como solución alternativa si un navegador no admite la API de compartir web?

Ah, y la API de compartir web sigue sin funcionar en iOS 14. :slightly_frowning_face: