content icon indicating copy to clipboard operation
content copied to clipboard

Error: TypeError: navigator.share is not a function

Open pcoch opened this issue 4 years ago • 1 comments

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share

What specific section or headline is this issue about?

Navigator.share()

What information was incorrect, unhelpful, or incomplete?

const shareData = { title: 'MDN', text: 'Learn web development on MDN!', url: 'https://developer.mozilla.org' }

const btn = document.querySelector('button'); const resultPara = document.querySelector('.result');

// Share must be triggered by "user activation" btn.addEventListener('click', async () => { try { await navigator.share(shareData); resultPara.textContent = 'MDN shared successfully'; } catch (err) { resultPara.textContent = Error: ${err}; } });

What did you expect to see?

Share API to work, currently returning error (Error: TypeError: navigator.share is not a function)

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
  • Folder: en-us/web/api/navigator/share
  • MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share
  • GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/navigator/share/index.md
  • Last commit: https://github.com/mdn/content/commit/a243190b798aa57b6cc08b9ef3216aed8ab9c895
  • Document last modified: 2022-09-22T16:39:52.000Z

pcoch avatar Dec 03 '22 23:12 pcoch

This doesn’t seem like a report about a specific problem in MDN content but instead seems better suited to getting help with on a site such as Stack Overflow.

sideshowbarker avatar Dec 04 '22 09:12 sideshowbarker