{"id":288685,"date":"2019-06-06T07:21:09","date_gmt":"2019-06-06T14:21:09","guid":{"rendered":"http:\/\/css-tricks.com\/?p=288685"},"modified":"2019-06-06T07:21:09","modified_gmt":"2019-06-06T14:21:09","slug":"how-to-use-the-web-share-api","status":"publish","type":"post","link":"https:\/\/css-tricks.com\/how-to-use-the-web-share-api\/","title":{"rendered":"How to Use the Web Share API"},"content":{"rendered":"
The Web Share API<\/a> is one that has seemingly gone under the radar since it was first introduced in Chrome 61 for Android. In essence, it provides a way to trigger the native share dialog<\/strong> of a device (or desktop, if using Safari) when sharing content \u2014 say a link or a contact card \u2014 directly from a website or web application.<\/p>\n While it\u2019s already possible for a user to share content from a webpage via native means, they have to locate the option in the browser menu, and even then, there\u2019s no control over what gets shared. The introduction of this API<\/abbr> allows developers to add sharing functionality into apps or websites by taking advantage of the native content sharing capabilities on a user\u2019s device.<\/p>\n <\/p>\n This approach provides a number of advantages over conventional methods:<\/p>\n Before we get into the details of how the API<\/abbr> works, let\u2019s get the issue of browser support out of the way. To be honest, browser support isn\u2019t great at this time. It\u2019s only available for Chrome for Android, and Safari (desktop and iOS).<\/p>\n This browser support data is from Caniuse<\/a>, which has more detail. A number indicates that browser supports the feature at that version and up.<\/p><\/div>\n
A note on browser support<\/h3>\n
Desktop<\/h4>