1

I'm creating a web page which will only be of use to users with a physical keyboard. It makes no sense to use it if you have an on-screen keyboard. (Think typing-tutor type webapp.)

Is there any way to detect that a physical keyboard is present, from Javascript?

If not, what is the most reliable way to detect that the browser is running on a tablet or phone, rather than a desktop/laptop?

fadedbee
  • 42,671
  • 44
  • 178
  • 308
  • 1
    You can do it in opposite way, can we detect an touch screen instead of a physical keyboard by doing `ontouchstart` – Ahmed Ali Dec 05 '19 at 12:19
  • 1
    Does this answer your question? [How do I detect hardware keyboard presence with javascript?](https://stackoverflow.com/questions/18880236/how-do-i-detect-hardware-keyboard-presence-with-javascript) – Ahmed Ali Dec 05 '19 at 12:20
  • Thanks for the comments, it's a pity that the page can't apologise to on-screen-keyboard users until they press a key. (The `ontouchstart` would catch touchscreen laptops.) – fadedbee Dec 05 '19 at 13:09

0 Answers0