1

Is it possible to tell if scroll lock mode is currently on through javascript without capturing scroll lock key press event (key was pressed outside of the browser)?

serg
  • 109,619
  • 77
  • 317
  • 330

6 Answers6

1

No. As you can see in the Event interface properties, there's no scroll lock key state.

Marcel Korpel
  • 21,536
  • 6
  • 60
  • 80
0

You can't get the status, but you can catch event when user press scrolllock button and use it as you like. Make your own status, show it to user and change it on keydown event.

puzzo
  • 1
0

Quick and easy: no

(99,9% sure)

jAndy
  • 231,737
  • 57
  • 305
  • 359
0

I guess you could dialog with your system through a COM component that would check the memory at adress 0x41? which is where the numlock/scroll lock status are.

Can't do it through JavaScript only though...

Gad
  • 41,526
  • 13
  • 54
  • 78
0
$(window).keydown(function (evt) {
    console.log(evt.which);
});

This is possible now Key : 145 for scroll

0

Yes, you can! :D

But not Always :'(

It depends on the OS :(

https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState

The KeyboardEvent.getModifierState() method returns the current state of the specified modifier key: true if the modifier is active (that is the modifier key is pressed or locked), otherwise, false.

Best regards!