Last active
April 5, 2017 03:57
-
-
Save arnellebalane/9027103671691352f168b42d094f01ce to your computer and use it in GitHub Desktop.
web share api demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// progressive enhancement, use it only when it is available | |
if ('share' in navigator) { | |
// the object argument to navigator.share() should have at least | |
// one of the following keys: title, text, url | |
navigator.share({ | |
title: 'The Web Share API', | |
text: 'The text that I want to share', | |
url: 'https://blog.arnellebalane.com/the-web-share-api' | |
}) | |
.then(() => console.log('Sharing successful')) | |
.catch((error) => console.log('Sharing failed')); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment