Detect virtual keyboard vs. hardware keyboard

前端 未结 6 2095
心在旅途
心在旅途 2020-12-05 06:36

I have been thinking about this a while now, and I can\'t figure a way to deal with it. Is there any way to detect if the user uses a virtual (software) keyboard or a tradit

6条回答
  •  悲哀的现实
    2020-12-05 07:16

    It may not be detecting the keyboard. But I would try detecting if the user is on a mobile browser. Since the devices that have native virtual keyboards almost unanimously run on mobile browsers.

    Here is a nice little script that uses jquery

    If they aren't mobile present your standard input field.

    If they are mobile do not display the input field (So they don't get the virtual keyboard), instead have a hidden field or list that gets updated with jquery when they click the buttons for your pinpad.

提交回复
热议问题