sudodoki / copy-to-clipboard

Copy stuff into clipboard from your browser using JS
http://sudodoki.github.io/copy-to-clipboard/example/
MIT License
1.27k stars 131 forks source link

Detect touch devices. #23

Open sudodoki opened 8 years ago

sudodoki commented 8 years ago

As suggested by @shvaikalesh in #3, just considering this a separate issue.

Also, messages like "double tap and choose copy" can be displayed on handheld devices.

Furthermore, it is possible to detect whether virtual keyboard or hardware one is used (innerHeight property of window shrinks when most of mobile keyboards slide up, except for iOS).

shvaikalesh commented 8 years ago

AFAIK, "double tap to copy" is only Android thing, so detecting heuristics will be even more sophisticated. However, according to can i use, Clipboard API via document.execCommand is not supported only by iOS <= 9 and support is coming to iOS 10. So I would not bother now.

davidhorm commented 4 years ago

I'm sure ya'll already solved this. But since this is still open after 4 years, I wanted to say that I solved this using https://developer.mozilla.org/en-US/docs/Web/API/Touch_events to know when a touch device fired something.

sudodoki commented 4 years ago

@davidhorm great to know, thanks! I guess this issue was one of enhancements list, so I didn't bang my head over solving it.