javascriptgoogle-chromeweb

Is there any way to use Web Share Api for other browsers than Chrome


I actually implemented Web Share API in Mobile web app, which is working fine in Chrome, since it is featured developed by Google for Chrome. But I want the same functionality to be work on few other browsers such as FF and Opera.

Is there any way to do so, or else it's mandatory to add Custom pop up for those browser whichever is not supporting Web API.


Solution

  • Support for WebShare API is spreading - it is now supported in Safari on both Desktop in Mobile as of early 2019. You can see the list of supported browsers here: https://caniuse.com/#feat=web-share

    You can easily feature detect if the client's browser supports it by doing if (navigator.share). Straightforward example here: https://alligator.io/js/web-share-api/

    But yes, if it's not supported you will need to create an alternative non-native pop up with the share options you want to offer the user. (This is what I just implemented at the news site I work at).