1

What I need is to detect, whether the caps lock key at the very moment is down. So I don't need the state (on/off), I want to check if the user keeps the caps lock pressed down. Is it possible with javascript? I want to create something like an Enso Launcher inside the browser.

Rakamazirem
  • 179
  • 1
  • 11
  • possible duplicate of [How do you tell if caps lock is on using JavaScript?](http://stackoverflow.com/questions/348792/how-do-you-tell-if-caps-lock-is-on-using-javascript) – T.J. Crowder Jul 09 '12 at 09:46
  • @T.J.Crowder OP emphasised that he doesn't ask for the state of CapsLock (on/off), but the act of holding the key. – Imp Jul 09 '12 at 09:48

1 Answers1

3

I want to check if the user keeps the caps lock pressed down.

On most browsers, you'll get keydown and keyup events for CapsLock, try it here (just focus the page and press a key). (This article has lots of useful info about keyboard events.)

keydown doesn't seem to repeat for CapsLock, the way it does for others, but you can watch for keydown and assume it's down until you see keyup.

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875