chessmsgs icon indicating copy to clipboard operation
chessmsgs copied to clipboard

Web Share

Open Deleplace opened this issue 4 years ago • 9 comments
trafficstars

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?

image

Deleplace avatar Jan 06 '21 16:01 Deleplace

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/

Deleplace avatar Jan 06 '21 16:01 Deleplace

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

gregsramblings avatar Aug 05 '22 06:08 gregsramblings

Hi Greg, this issue is "closed" but my brand new pending PR is at #8

Deleplace avatar Aug 17 '22 13:08 Deleplace

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 :)

gregsramblings avatar Aug 18 '22 05:08 gregsramblings

Clarification: it doesn't work on iOS Chrome. Works great in safari. :)

gregsramblings avatar Aug 18 '22 05:08 gregsramblings

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?

Deleplace avatar Aug 18 '22 09:08 Deleplace

Visiting chrome://inspect unveils the message Error: Sharing is not supported for this type of url

Deleplace avatar Aug 18 '22 09:08 Deleplace

So, iOS Chrome (Bling) seems to be the only browser being picky about sharing the object window.location. Please find the fix at #10.

Deleplace avatar Aug 18 '22 10:08 Deleplace

I also filed this improvement suggestion to the Chromium bug tracker.

Deleplace avatar Aug 18 '22 10:08 Deleplace