Web Share API for sharing content to arbitrary destination

Thanks @mgiuca and @owencmoore for the prompt and detailed responses. I’ll investigate the approach on Paul’s blog to handle share links and look forward to seeing what the conversation is on the WebView aspect.

Ideally, I’d like to move away from Cordova-based hosted web apps and stick with “pure” PWAs, but discoverability within app stores is still an expectation of many users, so being able to experiment with potential future features without having to develop and deploy updated packages to stores is advantageous.

Hi, using this api on desktop on Google Canary everything working fine. However,…

Trying to add it to AMP is a bit of a problem. The information is found here: https://ampbyexample.com/components/amp-social-share/

The biggest problem with it in AMP is that there is no fallback. I managed to get it working in Google Canary on an AMP page. But when I open the same webpage in Firefox Nightly the share button is missing.

My solution will require lots of extra coding to check if the user is using a Chrome or Android device and then either display the AMP code or my own code as a fallback.

This is not the best way and I think someone just needs to re-code and update the AMP Share Module Script to allow a fallback.

AMP has a “data-param-url” so if a developer/webmaster added this then surely it should load a fallback URL. At present doesn’t do anything.

Not sure where to voice my concerns…?

Also added here: https://github.com/ampproject/amphtml/issues/7982

1 Like

Hi, thanks for raising this. We definitely want to give people fallback options. In this case it’s an issue with AMP (not the API) so asking on the AMP bug tracker is the right place. I am also asking around at Google.

1 Like

Thanks mgiuca,

Hopefully you can pass this on to the person who created the AMP Module with your API (probably someone at Google?)

p.s. I managed to create a fallback in AMP, checking the browser type and it’s working fine. So this api works great in AMP and PWA. (Luckily I’m using Laravel, so can code around it).

Will keep checking the AMP Github for any reply to this, maybe I can help them with your api and their AMP Sharing Module.

(I hope your api makes it through the Origin Trial and lasts, I can picture it later on sharing to various apps in Chrome instead of just to the Web Share Target Test API).

The API works in PWA but is buggy. It sometimes doesn’t or takes a while. Does anyone know why?

I don’t know why yet but, readding the PWA fixed this. Maybe just a glitch

By “in PWA” do you mean when you added to homescreen, then open the app, and click the Share button from inside the app?

I can’t think why that would be a problem and I haven’t seen it. If you can reproduce it, please file a bug at https://crbug.com/new with details.

I might file the bug report on this but I need to make sure it’s not my coding error before I do so. For now; I have my domian at vrixe.com and the app home at vrixe.com/app. Steps to reproduce the bug:

  1. Go to vrixe.com/app
  2. Add the app to your home screen
  3. Open the PWA and open an event.
  4. Use the share button below the event card. No response.

I noticed that if step 1 weren’t to be vrixe.com/app but vrixe.com 2) then click menu 3) then follow to PWA link 4) then add PWA Page to home screen. The bug doesn’t manifest.

So it seems going directly to the page is the problem, I don’t know how that is, but it could be domain url or cache files not downloading properly. I’m doing some checks to confirm this, after which if not I’ll file a report. If anyone cares to follow this process and let me know what happens on their device. Thank you.

Also as a tip: the scripts calling this API if placed externally, must be in the same directory as the page for it to work. Noticed that while I was testing API.

Please do file a bug report on https://crbug.com/new, even if you are not sure it’s a Chrome bug. That is a much more appropriate place to be discussing a potential problem with Chrome’s implementation than on here (WICG is a browser-neutral place to be discussing web standards development). I don’t want to fill up this thread with this bug discussion, so let’s continue discussing on the Chrome issue.

Sure will, I understand you and thank you.

Hi, just renewed this Origin Trial. I have this API fully working in PWA (Desktop) and AMP (Mobile). Also have connected it up to GA and Tracking everything. Totally works great and amazing and zero bugs!

I really want this api to be added to Chrome. Where can I follow and keep in the loop when it expires in a few days time?

Hi Ayumi,

Thanks for all your feedback on Web Share so far! Much appreciated.

Web Share origin trial will be ending shortly before Chrome 58. The next steps are to put out a draft spec which I plan to do over the next few weeks, then discuss a permanent rollout with the web and Chromium communities. Updates will be posted to this thread, as well as the blink-dev mailing list (super high volume) and our WICG GitHub page.

1 Like

Hi mgiuca,

Thank you for all your hard work. Some more feedback for you. I ripped out the source code from Googlers Paul Kinlan blog and updated his code. If you look at his blog see an example link here: https://paul.kinlan.me/creating-a-share-button-web-component/

You will see he uses Web Share Button and a Subscribe Button. I know all the Google Chrome Team are trying to make the Web more Native.

My simple question to you is…? Would Google be interested in making an email newsletter native api (to connect up this Subscribe Button) ~ He connects it up to a RSS but I would rather see it being connected up to a Native Email Route just like your Web Share api.So that this one links up email and email newsletter subscriptions etc. If we are going the Native route then the user can get the same sort of pop-up box like your web share and be able to choose an email app etc.

Anyway, just an idea as I want to make my websites more and more Native. Yesterday added Googlers Addy Osmani idea of Autotrack plugin for GA to my PWA and then using that to track click events of your web share api…

Anyway, good luck with this api your are working on and hope it gets added to all the web browsers in the near future!

Is the API still working. I haven’t until yesterday requested for a new token but I didn’t think it’ll work since the trial time is over. I haven’t gotten the token yet anyways so… But It’ll really be nice to have this in chrome.

The API is now disabled in Chrome (as of April 17). You can still use it with the chrome://flags#enable-experimental-web-platform-features flag turned on, but no more origin trial. We’re working on standards discussions and, fingers crossed, Web Share will be back soon.

:crossed_fingers:then. Thanks a bunch

Is there anywhere to follow the standards discussion and see how Web Share is progressing since the end of the trial?

We don’t have a good place (i.e., a working group) for discussions right now. I’m having some private email chats. The most reliable public forums will be a) here, b) blink-dev (where we post Chrome-specific status updates) and c) the GitHub page and issue tracker.

I’ll try to post to this thread with updates as well. Thanks for your interest (and Phil especially thanks for the in-depth blog post).

1 Like

Thanks Matt. I’ve watched the GitHub repo, will try to keep up there.

The Web Share API has been implemented on Discourse (the software that runs this forum) and can already be used on the latest version.

To see it in action now, you can click on the :link: icon on any post on https://meta.discourse.org/t/introducing-the-web-share-api-web-google-developers/70515?u=falco

2 Likes