Menu
Is there any way to capture keyboard input from an entire page? Neither the Document nor the Window objects have an onkeypress event handler. I need something like an onkeypress for the entire page. For example, even if an input element has the input focus, I don’t necessarily want the typed text to show up in the element. I need all keyboard input to go through one function first. Does anyone have an idea as to what would be the best way to do this? Setting document.onkeypress to a function when the page loads does work on some browsers, but not all, and it is not standard.