I have tried navigator.canshare also but it's working in chrome desktop. It is giving undefined.
if (navigator.share) {
navigator.share({
title: 'Lot Quality Report',
text: 'Lot Link -',
url: 'https://www.google.com'
})
.then(() => console.log('Successful share')) //this is for sucess
.catch((error) => console.log('Error sharing', error));
} else {
console.log('Share not supported on this browser, do it the old way.');
alert('Share not supported on this browser, do it the old way.');
}
This code is not working on google chrome desktop in mac os. Any alternative I can use to run share functionality on google chrome desktop.
CodePudding user response:
I have found the answer, in mac os we need to change the settings of browser . Url - https://winaero.com/chrome-to-get-web-share-api-support-on-desktop/
Click on - chrome://flags/#web-share >> enable >> relaunch browser