Checking scroll lock, blocking Num Lock & Caps in JavaScript on page load

Can I check the status of Scroll Lock, Num Lock and Caps Lock when loading a page on a web page? I found ways to check after pressing a key using JavaScript, but this is not what I ask.

+5
source share
2 answers

No, you cannot get system state from javascript. You will need them to enter something, and then analyze the input. Probably not what you wanted to hear = /

+7
source

In 2019, this became possible:

var x = event.getModifierState("ScrollLock"); 

Source: https://www.w3schools.com/jsref/event_mouse_getmodifierstate.asp

0
source

Source: https://habr.com/ru/post/1344508/


All Articles