We can try switching the topic share icon action to the web share intent on supported platforms ( Chrome android for now)
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:
This only happens on Android yes? Seems fairly safe to me then. @gerhard can you review?
It’s merged and it works great on Chrome 61.
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?
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.
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.
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.
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.
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.
I don’t see those issues being fixed any time soon.
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.