In my web app using React, I am using Navigator.share()
to share some links.
Is it possible to know, which medium user selected for the share?
Here is the code which I am using
if (navigator.share) {
navigator.share({
title: 'Web Fundamentals',
text: 'Check out Web Fundamentals — it rocks!',
url: 'https://developers.google.com/web',
})
.then(() => console.log('Successful share'))
.catch((error) => console.log('Error sharing', error));
} else {
console.log('no share');
}
}
No, it does not seem to be allowed. Per the W3C specifications:
The user agent MUST NOT allow the website to learn which share targets are available, or the identity of the chosen target.
(from https://www.w3.org/TR/web-share/#share-method)
I have a feeling it is blocked for privacy reasons so that you don't know which apps a user has on their phone/device, and other things related to privacy.