Since Google Chrome and Firefox does not support Web Share yet, I need some alternative way to test this in development.
Sharing is achieved via this example:
if (navigator.share) {
navigator.share({
title: 'web.dev',
text: 'Check out web.dev.',
url: 'https://web.dev/',
})
.then(() => console.log('Successful share'))
.catch((error) => console.log('Error sharing', error));
} else {
console.warn('Cannot share in this browser')
}
Which will log for any unsupported browser:
Cannot share in this browser
Any ideas of how to get this to work for development?
It seems using Chrome Dev Tools to forward the local port to a remote device is the best way to debug on mobile devices and thus test PWA functionality on a device itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With