Skip to content

Instantly share code, notes, and snippets.

@w33zy
Created January 22, 2018 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save w33zy/bbc8ae3b7ad70d1a58cb2b04a1fd407a to your computer and use it in GitHub Desktop.
Save w33zy/bbc8ae3b7ad70d1a58cb2b04a1fd407a to your computer and use it in GitHub Desktop.
Native Sharing in Chrome for Android
function nativeSharing() {
if (navigator.share === undefined) {
console.log('Error: Unsupported feature: navigator.share');
return;
}
var title = document.title;
var text = 'Shared from Example.com';
var url = window.location.href;
try {
navigator.share({
title: title,
text: text,
url: url
});
} catch (error) {
console.log('Error sharing: ' + error);
return;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment