Introducing the Web Share API | Web | Google Developers

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

19 Likes

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 Likes

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

1 Like

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

8 Likes

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 Likes

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

Only the share button uses the new functionality.

13 Likes

It works on iOS 12.2 :tada:

11 Likes

I would like to see this working in Chrome OS. Discourse is already a PWA, so the stars are aligning.

I would also like to be able to share things TO discourse. For example, if I were to select an image to share to Discourse, it would create a new topic with the image inserted at the top. The title of the image would then be put as the topic title.
image

I also know a lot of people who use Windows, so support for that platform would also be great. They want to use the native menu. It looks very clean.

The same can be said for macOS, although I’m not too sure how the implementation would work.
image

TL;DR: I want to be able to share files TO Discourse in all major operating systems (both mobile and desktop). Along with that, I would like to be able to share links FROM Discourse on all major desktop operating systems. :slight_smile:

Also, does Firefox and Safari support the Web Share API? I originally thought that it was only supported in Chromium browsers.

This already works since Share to Discourse (via Android).

At the moment we implement only the V1 of the API, so only text. The V2 share target API allows uploads, but that is a bit harder to implement. pr-welcome.

3 Likes

It’s still too early to enable this on non-mobile devices. Here’s a couple of examples.

  • It won’t work on Chrome if you’re not using Windows or Chrome OS.
  • It won’t work on Edge unless you’re using windows.
  • It won’t work on Firefox regardless of what OS you use.

Can I use... Support tables for HTML5, CSS3, etc

I don’t see those issues being fixed any time soon.

6 Likes

Why not use Discourse’s own share sheet as a fallback if a browser doesn’t support the Web Share API?

Oh, and the Web Share API is still broken on iOS 14. :slightly_frowning_face: