'Failed to execute 'share' on 'Navigator': A earlier share had not yet completed

I just saw some users on my site experience this error

InvalidStateError: Failed to execute 'share' on 'Navigator': A earlier share had not yet completed.

This happens on this portion of the code:

if(navigator.share) {
  navigator.share({
    url: 'https://www.example.com',
  });
}

The MDN website do not even mentions about possibility of this error.

I saw the the error is coming from Chrome browser from Windows, Android and Chrome Os. I saw that chrome on mac do not have share feature as of now. Worth to mention that the issue happens quite rarely. I tried to reproduce it, by clicking the share multiple times fast, throttling cpu and network, canceling the share and I was never able to make it throw this error.

Do anyone know how to trigger this error or saw any documentation about it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source