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 curtidas

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 curtidas

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

1 curtida

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

8 curtidas

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 curtidas

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

Only the share button uses the new functionality.

13 curtidas

It works on iOS 12.2 :tada:

11 curtidas

Gostaria de ver isso funcionando no Chrome OS. O Discourse já é um PWA, então as estrelas estão se alinhando.

Também gostaria de poder compartilhar coisas PARA o Discourse. Por exemplo, se eu selecionasse uma imagem para compartilhar com o Discourse, ele criaria um novo tópico com a imagem inserida no topo. O título da imagem seria então usado como título do tópico.

Também conheço muitas pessoas que usam Windows, então o suporte para essa plataforma seria ótimo. Elas querem usar o menu nativo. Ele parece muito limpo.

O mesmo vale para o macOS, embora eu não tenha muita certeza de como a implementação funcionaria.

TL;DR: Quero poder compartilhar arquivos PARA o Discourse em todos os principais sistemas operacionais (tanto móveis quanto desktop). Além disso, gostaria de poder compartilhar links DO Discourse em todos os principais sistemas operacionais desktop. :slight_smile:

Além disso, o Firefox e o Safari suportam a Web Share API? Originalmente, pensei que era suportada apenas em navegadores Chromium.

Isso já funciona desde Compartilhar para o Discourse (via Android).

No momento, implementamos apenas a V1 da API, entĂŁo apenas texto. A API de destino de compartilhamento V2 permite uploads, mas isso Ă© um pouco mais difĂ­cil de implementar. pr-welcome.

3 curtidas

Ainda Ă© muito cedo para ativar isso em dispositivos nĂŁo mĂłveis. Aqui estĂŁo alguns exemplos.

  • NĂŁo funcionará no Chrome se vocĂŞ nĂŁo estiver usando Windows ou Chrome OS.
  • NĂŁo funcionará no Edge, a menos que esteja usando Windows.
  • NĂŁo funcionará no Firefox, independentemente do sistema operacional que vocĂŞ usa.

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

NĂŁo vejo esses problemas sendo resolvidos tĂŁo cedo.

6 curtidas

Por que nĂŁo usar o prĂłprio painel de compartilhamento do Discourse como alternativa se o navegador nĂŁo suportar a API Web Share?

Ah, e a API Web Share ainda está com problemas no iOS 14. :slightly_frowning_face: