How to detect if browser has Share API


I tried using

if (navigator.share) {
// we can use web share!
} else {
// provide a fallback here

but it gives error using ionic build --prod



I use:

Share.share(options).catch(err => {
  // provide fallback here

which uses the Web Share API if available (see and you can provide a fallback inside the catch.


Thank you. Got it working now.