Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You could detect caps lock by looking for these conditions:

* consecutive uppercase alpha characters are entered

* the shift property on the keyboard event is false



> consecutive uppercase alpha characters are entered

Why consecutive? Only one uppercase character without the shift key being used should be sufficient.

That being said, it's probably not the best method as the users can also copy/paste passwords, or use a password manager.


That is why consecutive key events is necessary, to distinguish character versus a string paste operation.


Isn't keypress and paste two different events?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: