w3c / web-share

Web API proposal for sharing data from a web page
https://www.w3.org/TR/web-share/
Other
353 stars 65 forks source link

Web Share API fails to share a fully loaded data object/partial data object with file #279

Open benedict-wong opened 1 year ago

benedict-wong commented 1 year ago

Hello!

I've noticed a recent bug with the Web Share API which began to occur about a month ago (June 2023). Previously, I was able to share a fully loaded data object (title, text, url, file) together, but now when I try to do the same, only the url and file shows up when sharing. Additionally, this fails for any combination that includes a file, even when its not fully loaded (i.e. title and file, text and file, etc.) where only the file shows up.

It seems this issue affects both Android and iOS, even with the latest versions/updates installed. You can replicate it with the w3c Web Share Test demo here: https://w3c.github.io/web-share/demos/share-files.html.

marcoscaceres commented 8 months ago

hhhmm... how the share is handled when it's "mixed" is really just left to the underlying platform. It's unfortunate that the mix is not throwing and returning false with canShare().

leitejppb commented 6 months ago

Does anyone have an update on this issue?

I'm currently integrating this functionality on my project and I'm having the same problem when sharing an object with an URL and Files together. When testing on an Android (Chrome 121, Android 13), using the URL/Files combination instead of the Text seemed to work the best in most cases, but for iOS, in some apps either the file or text/url were not being shared (tested on an iOS 16 device)

marcoscaceres commented 6 months ago

I’m still not sure this is a spec issue. It sounds like underlying platform or native share target issues. Which application is handling the share?

Cc @tomayac

leitejppb commented 6 months ago

It might be a limitation with the targets as you've said.

I've tested with both web-share on a React web app and react-native-share, and for Android I got the same results. From the apps I've tested, on Android it was working well using the URL/Files combination and only Messenger and Instagram Message were discarding the URL and only sending the image, but from what I've read, it seems that Messenger does not allow to send both things.

It was the same thing for iOS, although I found that on iOS I had more issues when sharing both an image/text or url. On WhatsApp it was only sending the text or the url and always discarding the file for iOS even though on Android it worked correctly. And creating a post on Facebook it was only sending the image with Text/File and.

I will post the result of the tests I've done. Maybe someone had a different experience or has some recommendations?

Android Web:

Android Web

iOS Web:

Screenshot 2024-02-29 at 16 44 59

(Although the next screenshots are not related to this library, I think they might be useful to compare with the web api's)

Android Native:

Screenshot 2024-02-29 at 16 44 11

iOS Native:

Screenshot 2024-02-29 at 16 41 42

marcoscaceres commented 3 months ago

Thanks for the additional information @leitejppb (and sorry for the delay in replying).