chessmsgs
chessmsgs copied to clipboard
Web Share
Great project, I :heart: the minimalism!
On a smartphone, the "idiomatic" way to send something to someone else (the opponent) is a [Share] button, rather than copy/paste thru the clipboard. I think we should add such a button: displayed for platforms that support it natively (i.e. all major mobile browsers), hidden for platforms that don't (i.e. desktop browsers).
Shall I attempt a PR?

A few links about the "Web Share API" standard thats works in mobile web pages, providing the same experience as native mobile apps:
- https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share
- https://caniuse.com/?search=web%20share%20api
- https://css-tricks.com/how-to-use-the-web-share-api/
Hey Valentin! I haven't touched this project in over a year (obviously) but am coming back to it to update a few things.
I'd love to implement this functionality. If you're up for a PR, I'd be super thankful! If you're too busy, I totally understand and can use the resources you shared to get it done.
It's good hearing from you. I'll ping you on Twitter so we can catch up
Hi Greg, this issue is "closed" but my brand new pending PR is at #8
Thank you! It's not working on iOS for some reason. The button tap is ignored. I'll try to look into it tomorrow. I'll leave it deployed for now since the copy still works. Easier to test :)
Clarification: it doesn't work on iOS Chrome. Works great in safari. :)
I confirm it doesn't work correctly on iOS Chrome. Which is a bit weird as navigator.share being truthy is what triggers the new button to be displayed at all — but then indeed the action does nothing for some reason.
CanIUse and MDN are not super clear about which category "iOS Chrome" belongs to: is it a flavor of regular Chrome? Is it a thin UI layer on top of iOS Safari?
Visiting chrome://inspect unveils the message Error: Sharing is not supported for this type of url
So, iOS Chrome (Bling) seems to be the only browser being picky about sharing the object window.location. Please find the fix at #10.
I also filed this improvement suggestion to the Chromium bug tracker.