Web Share API From Google Smoothes Over Sharing

Google recently debuted the Web Share API, a simple coding tool that allows websites to bank on the sharing capabilities baked into the host platform. The idea here is to give users more control over when and where their data is shared. 

"There have been a number of ways to invoke native sharing capabilities on the platform, but they all have significant drawbacks," explained Google's Paul Kinlan in a blog post. For example, protocol handling doesn't support mobile, and the Android Intent only supports Google's own Android platform -- leaving Chrome, Web, and other developers in the cold. 

"The Web Share API is a promise-based, single method API that takes an object with properties named title, text and url," explains Kinlan.

The Web Share API will make its debut in Chrome 55 (still in beta). Specifically, Google has implemented an Origin Trial in Chrome 55, meaning it is opt-in only. Web developers will need to register in order to score access during the trial period. Google warns the Web Share API Mays undergo breaking changes during the trial period. 

When invoked, the API will call up the native picker for sharing to apps on the phone. The user can then pick the app to which they'd like to share and go. 

Google says there are a few constraints. To start, developers will need to host their site securely (think HTTPS). They'll also need to supply Google with at least one of "text" or "URL" if not both. Moreover, only end users can invoke the Web Share API. This means apps can't make unwarranted API calls in an onload handler, for example. Any property values passed through the API need to all be strings. Google also warns that the API doesn't yet support all platforms, and asks that developers come up with gracious ways to explain that to end users. Last, Google asks developers to understand that most people will likely be sharing from mobile devices, so URLs need to be efficient and/or at least very accurate. 

In order to get started, developers will need to download Chrome 55, sign up for the trial, adds the tokens, and wait for a user-generated gesture. 

Be sure to read the next Web Site Management article: Google Offering Good Housekeeping Seal of Approval to Selected Web Developers

 

Comments (0)