Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PWA: Getting Web Share API to work in development

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?

like image 945
Werner Avatar asked Jan 27 '26 12:01

Werner


1 Answers

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.

like image 152
Werner Avatar answered Jan 29 '26 02:01

Werner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!