I'm trying to use navigator.canShare()
and navigator.share()
to experiment with websharing in a react app.
When I call navigator.canShare()
in react, I get the following run time error:
TypeError: navigator.share is not a function
How can I get react to recognize navigator.canShare()
?
CodePudding user response:
As mentioned in MDN docs, you can only use navigator.share()
over HTTPS
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.