0

I use web share API, according to caniuse website it should be supported on Windows OS (browsers Chrome and Edge). But when I try to use navigator.share({ title: 'Title' }); I receive an empty window with the message.

enter image description here

If I use Mac OS Safari it works fine and shows all ways to share the content, for example.

enter image description here

My question is why on Windows I see the empty window and how to fix it.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Max
  • 781
  • 7
  • 19
  • Did you read and [supporting documentation](https://developer.mozilla.org/en-US/docs/Web/API/Web_Share_API)? For instance, the [`canShare`](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/canShare) method, and what OSes need to provide to browsers in order to be able to share things? For instance, when I try to run the [live example on MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share#examples), I get an error. – Heretic Monkey Mar 20 '23 at 14:53
  • I've checked the support in the documentation. It says the same that the feature should work on Windows in Chrome and Edge browsers. I suspense that I send wrong parameters. I need to add text and url in the body of the share methdo. – Max Mar 20 '23 at 15:20

1 Answers1

0

The problem was that Windows required url parameter to be sent with title. If you change it to navigator.share({ title: 'Title', url: 'url' }); It will start working on Windows and MacOS.

Kevin Panko
  • 8,356
  • 19
  • 50
  • 61
Max
  • 781
  • 7
  • 19