I have a button I use to share links, externally, on my webapp. When you click on it, it's suppose to launch the mobile share dialog (see screenshots). This works in iOS but on Android it launches the desktop version.
const shareButton = document.querySelector('.share-button');
const shareDialog = document.querySelector('.share-dialog');
const closeButton = document.querySelector('.close-button');
shareButton.addEventListener('click', event => {
if (navigator.share) {
navigator.share({
title: 'Je-Bwoy - Yesu Nti',
url: 'https://www.repjesus.com/browse/audio/12133/brooke+ligertwood+-+honey+in+the+rock+with+brandon+lake.html'
}).then(() => {
console.log('Thanks for sharing!');
})
.catch(console.error);
} else {
shareDialog.classList.add('is-open');
}
});
closeButton.addEventListener('click', event => {
shareDialog.classList.remove('is-open');
});
Here is the button
<button class="share-button" type="button" title="Share this article">
<span><i class="fas fa-share-alt-square"></i>Share</span>
</button>