Detect whether browser has keyboard/arrow keys in web page

前端 未结 8 933
忘了有多久
忘了有多久 2020-12-31 00:21

I have a full-screen game in HTML+JavaScript, which uses the arrow keys as primary controls. This cannot be used on keyboardless Android devices (I haven\'t tested on iOS),

8条回答
  •  鱼传尺愫
    2020-12-31 01:08

    look for touch specific events such as touchstart or gesturestart and show the onscreen controls if detected.

    http://developer.apple.com/library/safari/#documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html

    I am not sure if the system-info api has been implemented by any browsers: http://www.w3.org/TR/system-info-api/

提交回复
热议问题