Introduction to webshare API (navigator.share)


navigator.share is a JavaScript API providing a sharing interface similar to native apps

webshare API is supported on most updated mobile browsers Including Google chrome for Android

Sharing is done by passing an Object with parameters "url", "text" or "title" to navigator.share function.

For a webshare request to succeed you must supply at lest one of the parameters

navigator.share returns a Promise upon being called "upon

navigator.share({
    "url": document.location,
    "text": "I'm an example",
    "title": document.title
})
.then(resp => console.info("Successfully shared"))
.catch(errors => console.error(errors))

Comments

Popular posts from this blog

How to set content disposition header for nginx server to force content download

Animated daylight on HTML5 Canvas

How to make a static http server in nodejs using express

How to make a Snake Game using JavaScript and html5

JS13K Preparation