Is there a way to catch all keyboard input in a browser? Im guessing it would have to be JavaScript.
My problem is that I have a USB Bar Code Scanner which the computer treats as a second keyboard. I dont want the user to have to click on the input box for bar codes to be entered in it. But I also want them to be able to hit key short cuts that perform an action that does not display that input in the text box. Also can the f1 – f12 keys be used in this manner or are they reserved for the browser itself?
keydownwill fire for most keys (certainly more thankeypress) in most browsers (some, such as Safari 3.0, won’t fire any events for modifier keys such as Shift) and all keys in recent browsers. The behaviour of function keys is not a good thing to rely on though.The following page is an excellent reference for key events in JavaScript: http://unixpapa.com/js/key.html