Navigator.share (Permission denied)

I added an Iframe to my website, in order to use “navigator.share”, and the following code is triggered when the user clicks a button contained in the Iframe:

if (navigator.share) {
navigator.share({
title: ‘Web Share Test’,
text: ‘Take a look at this!’,
url: ‘www.google.com’,
})

The code works, as you can see here:
https://innovemsociais-wixstudio-io.filesusr.com/html/fb7c74_b668cae72f9b4bae5979d1e548d30224.html

But when I open the actual page on my website where I want the share button to be, I keep getting an error (Permission Denied).

I tried using ''Allow=web-share", but no luck. Can anyone help me?

Not all browsers and OS’s support this feature. Even on my own computer (Chrome and MacOS) it fails.

See "navigator.share" | Can I use... Support tables for HTML5, CSS3, etc for more info