I have been looking through the answers to this Stack Overflow question, and it is pretty much just a ton of answers showing different ways to check if CapsLock is on, with some event listener.
In those many solutions, I found one that I think is the best of them all, but there is one problem with all of them. They all depend on some sort of input (onkeyup
or click
listeners are used), I would like to (if possible) do a check the instant the page is loaded to check if CapsLock is currently on, and then use the solution I chose, to check if the CapsLock state changes during input.
Is this possible?
Is there some way that we can just use the event.getModifierState
without having an event
?