Web-apps: Can the iOS share sheet be triggered – a

2019-04-14 20:54发布

问题:

Specifically, I would like to share granular page content via triggering the iOS share sheet with in-page buttons.

In my webapp page, I have a table of downloadable PDFs. I would like to be able to add a column called "Share" into the table, so that a button could be tapped to share the URL to that document, without having to open the document itself and share from there.

In order to do this, I assume I would need to customise this triggered share sheet to share a different URL to the one that is showing in mobile safari's address bar.

Is this possible using javascript, or alternative URLs in a meta tag maybe? I don't expect URL scheme to be a solution, as it is concerned with sending data to another application.

回答1:

Not currently on ios but a new w3c spec is on the way called web share api. Currently only available in chrome for android behind a origin trail.

https://developers.google.com/web/updates/2016/10/navigator-share



回答2:

It will be supported in Safari iOS V12.2. The beta of V12.2 already has it.

There's a good article by Maximiliano Firtman on a number of new features that will be possible in the new version.