Capture The Events Of 2 Or More Keyboards In JavaScript/Web Browser
Solution 1:
No, with current browser environments you can not support multiple distinct input devices of a particular type. I am also not aware of any upcoming specs that would enable something like this. Generally it is assumed that a browser has only one user at at time. I don't think anything like this will be supported.
That said, there is a spec for gamepad support that is currently being developed. It is not supported by non-dev builds of browsers yet but both Firefox and Chrome are working on it. There is already an interesting library called gamepad.js if you are interested in this technology.
For now, to support multiple players you will probably have to do what most games do to support multiple keyboard based players, map each player to a different cluster of keys.
Update 2015-05-04
Support for the Gamepad API has gotten better since this answer, both Firefox and Chrome have support going back several versions now, and Opera supports it too. But not all browsers do, Safari and IE do not. Microsoft's new browser Edge looks like it will have support for the Gamepad API but it will probably take a long time to get most of the IE users to migrate to Edge or another browser.
Post a Comment for "Capture The Events Of 2 Or More Keyboards In JavaScript/Web Browser"