I wanted to know if it is possible to track which option the user used to share something with the webshare api (for example if it was shared via WhatsApp or Facebook).
Thanks in advance.
That is not possible. See the specification of the WebShare API's share
method:
The user agent MUST NOT allow the website to learn which share targets are available, or the identity of the chosen target.
The promise that is returned will resolve when the user shares something, but the resolved value is just undefined
:
[...]
- Once the data has been successfully transmitted to the target, resolve
[[sharePromise]]
withundefined
.
You only know whether it has been shared or not, but you don't know with whom.