2

I'm looking for a solution to detect if the device accessing my webapp is using a hardware keyboard or not.

Some background: We are developing a webapp which is used in a logistical environment to accept shipments. The webapp is accessed through a tablet mounted on forklifts. The tablet can be easily removed by the employee to take pictures for example. The employee must put in the number of pieces in the shipment, as well as the total weight. The cradle on the forklift has a physical keyboard, which connects to the cradle via USB. The tablet is an Android device by Zebra, running Android 5.1.1, with the default Chromium browser.

So to summarize: When the tablet is mounted on the cradle, the employee uses a physical keyboard to do his inputs. When he uses the tablet by hand, a virtual keyboard should be shown for inputs. To not block the whole site, I'd like to use a custom virtual keyboard (that's already present but ignores hardware inputs).

I've checked the following topics: How do I detect hardware keyboard presence with javascript?

The topic above has a few solutions offered, but those aren't really satisfying. The topic-startes requires a single button to be shown when no physical keyboard is detected. For simplicity's sake I'd prefer not to have a questionbox shown to the user to ask him/her if they're using a physical keyboard, as this might change quite a few times during their shift.

  1. Finding if external usb or bluetooth keyboard attached in Android
  2. How to determine whether a user has a keyboard attached in Javascript

Any takers?

Thanks!

Stefan

El_Stevo
  • 31
  • 6
  • This might help https://stackoverflow.com/questions/2415558/how-to-detect-hardware-keyboard-presence?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – sneharc Jun 08 '18 at 08:58
  • I just added a new answer to the above [here](https://stackoverflow.com/a/52327649/2376004) – Bad Loser Sep 14 '18 at 08:17

0 Answers0