I have a single browser on top of my Java Swing Frame and I am trying to catch keycodes on this browser containing a HTML page using Javascript. The keys I am reading are the "left" and "right" arrow keys. For which, I am using the keycode 37 and 39. This keypress seem to work well in normal browsers like IE , Firefox and Chrome. However, on my CEF browser instance , the keycode corresponds to 255 for all the arrow keys. I am trying to understand why this is the case.
NOTE: keycodes for enter, backspace, A-Z and numbers seem to work fine. The arrow keys, shift,alt, F-1 to F-12 keys and num unlocked 1-9 keys all correspond to 255. Should I change some setting i my JCEF browser instance for this ?
I use a normal en-US Keyboard.
snippet of my code :
- Code: Select all
{
if(target.keyCode ===37) {
console.log("left key pressed");
} else if (target.keyCode===39){
console.log("right key pressed");
}
...//For all other keys
console.log(target.keyCode);
}