1

i have tried to disable whole keyboard using javascript but windows start key is not disabled same way enter key is also not disabled using my script

<script type='text/javascript'>
  document.onkeydown = function (e) {
    e.preventDefault();
  }
</script>
Juned Ansari
  • 5,035
  • 7
  • 56
  • 89
  • 3
    http://stackoverflow.com/questions/19628081/how-to-disable-full-keyboard-keys-using-javascript-or-jquery – Hosseini May 27 '16 at 09:08
  • 3
    http://stackoverflow.com/questions/16556433/how-to-disable-windows-keys-logo-key-and-menu-key-using-javascript http://stackoverflow.com/questions/18984997/is-it-possible-to-block-the-windows-key-from-a-web-browser – Thilo May 27 '16 at 09:11
  • 1
    You only control what the keys do within the browser, you can't expect the browser to prevent the windows key from working. It would be a major security issue if JS could affect the users entire computer. – DBS May 27 '16 at 09:19
  • ok is there any other solution for this? – Juned Ansari May 27 '16 at 09:55

2 Answers2

3

I think you cannot prevent windows key action because after pressing the window key browser doesn't detect it. The reason is that windows key doesn't affect the browser.

Shubham Agrawal
  • 298
  • 4
  • 10
0

Try this:

document.onkeydown = function (e) {
        return false;
}