Bug 198606 - Implement the Web Share API Level 2
Summary: Implement the Web Share API Level 2
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 12
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 207491 209265
Blocks:
  Show dependency treegraph
 
Reported: 2019-06-06 04:41 PDT by Thomas Steiner
Modified: 2021-01-12 04:08 PST (History)
15 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Steiner 2019-06-06 04:41:03 PDT
WebKit supports "Web Share — Level 1" since https://bugs.webkit.org/show_bug.cgi?id=171100 was resolved (🙏 thanks!).

"Web Share — Level 2" adds a feature detection method `canShare()`, and the `ShareData` dictionary now has a `files` member for sharing files (https://wicg.github.io/web-share/level-2/#changes-since-level-1).

This allows use cases like sharing images apart from text.
Comment 1 Gabriele Nosso 2020-04-03 04:24:36 PDT
Hi everyone,
I am Gabriele, Software Architect for X-Rite Pantone (www.pantone.com, www.xrite.com).

We have hundreds of thousands per user on our website per month, so we are expecting a high number of users also in our new apps.

We will soon release a mobile App for Pantone  for both iOS and Android, which will provide a sharing palettes/pictures features.

It would be amazing to have the Web Share Api level 2 implemented, so we could make the feature available also on iOS.

Is there any ETA for this task?

Thanks.
Comment 2 Samy Dindane 2020-04-09 08:13:20 PDT
Hello,

My name is Samy and I am the founder of Hypefury. We help online entrepreneurs grow their audience and market their products.

We already implemented features such as sharing pictures on Instagram, and they work perfectly on Android.

Most our users use iPhones though, and supporting level 2 sharing would make their experience a whole.

Thank you,

Samy
Comment 3 Thomas Steiner 2020-05-06 01:21:10 PDT
Fixed via https://bugs.webkit.org/show_bug.cgi?id=207491.
Comment 4 Maciej Stachowiak 2020-05-07 02:16:40 PDT
Looks like this hasn't fully landed yet, so reopening and adding relevant dependencies.
Comment 5 Maciej Stachowiak 2020-05-10 18:50:24 PDT
All subtasks are complete, but this isn't enabled by default yet.
Comment 6 Erik Murphy-Chutorian 2020-05-20 10:15:57 PDT
I'm thrilled to see the progress on this bug. Media sharing for 'image/jpeg' and 'video/mp4' files has been a top requested feature for our web platform from numerous big brands and creative agencies.

Any chance this will be enabled by default in iOS 13.6+?
Comment 7 Matt Oakes 2020-05-28 07:20:12 PDT
Just to note that while the "canShare" method was implemented and accepted, support for the "files" property is still not implemented.
Comment 8 Erik Murphy-Chutorian 2020-05-28 08:07:20 PDT
@Matt, even with the following resolved dependent bug "Implement web-share v2 for files"? https://bugs.webkit.org/show_bug.cgi?id=209265
Comment 9 jcesarmobile 2020-07-06 10:01:54 PDT
Seems to be implemented on iOS 14 (first beta) including WKWebView, but with a few problems.

I tested with this website https://w3c.github.io/web-share/demos/share-files.html

The title is not used, the message is shown instead.

Sharing to AirDrop sometimes show an error or don't properly share some of the items.
Sharing to twitter doesn't show the selected images and don't let you share (probably because of that)
Sharing to messages or mail doesn't attach the images.


Other than that, it looks like a good starting point for iOS 14 before it's final.
Comment 10 jcesarmobile 2020-07-06 10:08:09 PDT
Note that "Web Share API Level 2" is still disabled as default in the experimental section of Safari settings, but it's working fine without enabling it. Not sure if it could stop working in future beta releases or if it means that it is no longer experimental.
Comment 11 rigel 2020-09-17 10:21:13 PDT
This API works well but is turned off by default in iOS 14. Please either turn it on by default or promote it out of experimental features as many of our customers rely on this functionality. Thank you.
Comment 12 Erik Murphy-Chutorian 2020-09-17 10:40:01 PDT
WebShare V2 was working really well in all of the iOS14 betas for file sharing, and we were looking forward to see this launch (default-enabled) in iOS14. This was the most exciting thing about iOS 14 for my company. It is such critical functionality for web developers to be able to share mp4 video files and jpgs to native applications, and Safari is really the only remaining majority browser lacking this ability.


Needless to say, is was discouraging to see it switch off with the public release after building websites in anticipation that would have worked well had the public release matched the betas. Please re-enable WebShare V2 file sharing as a default for Safari users!
Comment 13 Blake Bullis 2020-09-22 07:45:49 PDT
Sad here as well to find L2 is disabled by default in the latest iOS update. Please enable by default, we live in a world of sharing media and this feature will allow developers to enrich the user experience for all Apple users.
Comment 14 Marcos Caceres 2020-09-23 20:09:19 PDT
Note that "Level 2" is no longer a thing: The the "L2" stuff has is being merged into the core spec, and "L2" just redirects to the main spec. 

Note also that Mozilla folks found significant issues with .canShare():
https://github.com/w3c/web-share/issues/108#issuecomment-697689527

This issue can probably be closed as invalid.
Comment 15 Marcos Caceres 2020-09-23 23:15:31 PDT
Just want to clarify that I think the "level 2" support aspect of this bug is invalid (because there is no level 2 spec anymore). However, other bugs that arise from sharing files and .canShare() should be addressed separately.
Comment 16 Thomas Steiner 2020-09-24 01:25:16 PDT
Updated core spec link: https://w3c.github.io/web-share/#api-definition.

This is implemented behind a flag in Safari 14 (using the "Level 2" name suffix), so the status of this bug is probably "Resolved".

Other questions like the fate of `canShare()` indeed deserve new bugs once the spec issues have been closed.
Comment 17 Rodrigo Schneider 2021-01-11 11:38:50 PST
There's already some ETA for this one in Safari? I mean, it's really important for us Web devs to have (specially on iOS / iPadOS devices) this feature. Giving the user by just clicking some button on the page the ability to share something with any app would be awesome. It says "RESOLVED FIXED" but as far as I saw (including Safari Beta versions) it's not already there.
Comment 18 Ryosuke Niwa 2021-01-11 15:03:42 PST
(In reply to Rodrigo Schneider from comment #17)
> There's already some ETA for this one in Safari? I mean, it's really
> important for us Web devs to have (specially on iOS / iPadOS devices) this
> feature. Giving the user by just clicking some button on the page the
> ability to share something with any app would be awesome. It says "RESOLVED
> FIXED" but as far as I saw (including Safari Beta versions) it's not already
> there.

Seems to be enabled in iOS 14 / Safari 14 as far as I checked? Which feature are you talking about?
Comment 19 Rodrigo Schneider 2021-01-11 15:21:00 PST
(In reply to Ryosuke Niwa from comment #18)
> (In reply to Rodrigo Schneider from comment #17)
> > There's already some ETA for this one in Safari? I mean, it's really
> > important for us Web devs to have (specially on iOS / iPadOS devices) this
> > feature. Giving the user by just clicking some button on the page the
> > ability to share something with any app would be awesome. It says "RESOLVED
> > FIXED" but as far as I saw (including Safari Beta versions) it's not already
> > there.
> 
> Seems to be enabled in iOS 14 / Safari 14 as far as I checked? Which feature
> are you talking about?

Hey, sorry! I forgot to explain it better, what I meant is about the canShare method of the API, this one is not already shipped, as it says here in the original feature link from Chrome Status (https://www.chromestatus.com/feature/4777349178458112#:~:text=Web%20Share%20API%20Level%202%20allows%20sharing%20of%20files%20from,urls%20could%20previously%20be%20shared.) right? That would be a great feature for the devs.
Comment 20 Ryosuke Niwa 2021-01-11 15:24:53 PST
(In reply to Rodrigo Schneider from comment #19)
> (In reply to Ryosuke Niwa from comment #18)
> > (In reply to Rodrigo Schneider from comment #17)
> > > There's already some ETA for this one in Safari? I mean, it's really
> > > important for us Web devs to have (specially on iOS / iPadOS devices) this
> > > feature. Giving the user by just clicking some button on the page the
> > > ability to share something with any app would be awesome. It says "RESOLVED
> > > FIXED" but as far as I saw (including Safari Beta versions) it's not already
> > > there.
> > 
> > Seems to be enabled in iOS 14 / Safari 14 as far as I checked? Which feature
> > are you talking about?
> 
> Hey, sorry! I forgot to explain it better, what I meant is about the
> canShare method of the API, this one is not already shipped, as it says here
> in the original feature link from Chrome Status
> (https://www.chromestatus.com/feature/4777349178458112#:~:
> text=Web%20Share%20API%20Level%202%20allows%20sharing%20of%20files%20from,
> urls%20could%20previously%20be%20shared.) right? That would be a great
> feature for the devs.

I don't understand why you're referring to Chrome Status page but canShare API is definitely implemented and present in iOS 14 and Safari 14.
Comment 21 jcesarmobile 2021-01-11 15:31:56 PST
I forked this fiddle
https://jsfiddle.net/ericwilligers/8cpuskqd/

Removing the canShare() checks as they don’t work (as it’s non standard)
And sharing images don’t seem to work on latest beta

https://jsfiddle.net/g1uLhvpw/
Comment 22 rigel 2021-01-11 15:34:59 PST
I was under the impression this was fixed but hadn't made it into an iOS build yet.

See: https://bugs.webkit.org/show_bug.cgi?id=217105
Comment 23 Ryosuke Niwa 2021-01-11 15:36:26 PST
(In reply to jcesarmobile from comment #21)
> I forked this fiddle
> https://jsfiddle.net/ericwilligers/8cpuskqd/
> 
> Removing the canShare() checks as they don’t work (as it’s non standard)
> And sharing images don’t seem to work on latest beta
> 
> https://jsfiddle.net/g1uLhvpw/

What Safari / iOS version did you test? It's working for me on Safari 14 & iOS 14.
Comment 24 jcesarmobile 2021-01-11 15:39:33 PST
Latest beta of iOS 14.4

According to my comment from last July, it was working fine on the first iOS 14 beta
https://bugs.webkit.org/show_bug.cgi?id=198606#c9
Comment 25 Ryosuke Niwa 2021-01-11 15:42:00 PST
(In reply to jcesarmobile from comment #24)
> Latest beta of iOS 14.4
> 
> According to my comment from last July, it was working fine on the first iOS
> 14 beta
> https://bugs.webkit.org/show_bug.cgi?id=198606#c9

Did you test it in Safari or some other app that embeds WKWebView?
Comment 26 jcesarmobile 2021-01-11 15:43:01 PST
Safari
Comment 27 jcesarmobile 2021-01-11 15:43:10 PST
Safari
Comment 28 Ryosuke Niwa 2021-01-11 15:45:25 PST
Ah, my bad. I was getting confused. Web Share v2 is indeed not yet enabled in iOS 14 / Safari 14.
Comment 29 Tim Horton 2021-01-11 23:14:54 PST
Sorry, somehow I missed all the comments here... let me lend some clarity:

(In reply to jcesarmobile from comment #10)
> Note that "Web Share API Level 2" is still disabled as default in the
> experimental section of Safari settings, but it's working fine without
> enabling it. Not sure if it could stop working in future beta releases or if
> it means that it is no longer experimental.

This was a bug, fixed in https://trac.webkit.org/changeset/266158/webkit.

(In reply to Marcos Caceres from comment #14)
> Note that "Level 2" is no longer a thing: The the "L2" stuff has is being
> merged into the core spec, and "L2" just redirects to the main spec. 

We know, and this could be retitled "Support canShare and ShareData.files" or something; but it does track a code change, so is /not/ status->invalid.

(In reply to Rodrigo Schneider from comment #17)
> There's already some ETA for this one in Safari? I mean, it's really
> important for us Web devs to have (specially on iOS / iPadOS devices) this
> feature. Giving the user by just clicking some button on the page the
> ability to share something with any app would be awesome. It says "RESOLVED
> FIXED" but as far as I saw (including Safari Beta versions) it's not already
> there.

https://trac.webkit.org/changeset/267762/webkit tracks turning the "level 2 but not called that anymore" features on everywhere that the "level 1 but not called that anymore" features are on...

... however, Apple doesn't comment on the timing of features (there was some confusion about this feature because of the aforementioned bug causing it to be available in beta releases; apologies for that!!).
Comment 30 Rodrigo Schneider 2021-01-12 04:00:16 PST
(In reply to Tim Horton from comment #29)
> Sorry, somehow I missed all the comments here... let me lend some clarity:

> 
> https://trac.webkit.org/changeset/267762/webkit tracks turning the "level 2
> but not called that anymore" features on everywhere that the "level 1 but
> not called that anymore" features are on...
> 
> ... however, Apple doesn't comment on the timing of features (there was some
> confusion about this feature because of the aforementioned bug causing it to
> be available in beta releases; apologies for that!!).

Hi Tim, thanks for bringing all the explanation and the link for a "correct", let's say so, feature tracking of what we really need. I'll follow up there. :)