I am developing a virtual keyboard extension for Firefox. One of the features of this extension is converting the keys the user presses to another layout.
Example: I need to type text on Bashkir layout but my OS does not support it. So, I can use this virtual keyboard extension and not change the system settings.
It's needed on Windows XP which does not support many languages.
I used event.keyCode
to detect which key was pressed. I used it because it detects the key code despite the system layout.
But I missed that in Firefox if the keyboard is a non-English layout, event.keyCode
doesn't work correctly with some keys, namely [ ] ; ' , . / and .
If I type the q key, keyCode
returns 81 and if I type in Russian й, which is the same key, keyCode
also returns 81
. But If I type the [ key, keyCode
returns 219
and if I type in Russian х, which is the same key, keyCode
returns 0
.
Do any keyCode
alternatives exist?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…