How to lock the keyboard in jquery?


How to lock the whole keyboard in jquery, especially the esc key to full screen, I want you to not quit the fullscreen when you press esc


$(document).keydown(function(e) { 
    if (e.keyCode == 13) { return false; }
    if (e.keyCode == 27) { return false; }    

It is a user registry and it stays on a specific computer just to register these users, the pc will not have any other function other than this one.

asked by anonymous 10.05.2014 / 14:31

1 answer


For security reasons, no browser will allow a page to remove the user from the most basic controls - such as minimizing the window, switching to another, and so on. Nothing prevents you from using Alt + or Ctrl / kbd> - and from there the user will probably be able to do whatever he wants. I do not really know fullscreen mode, but I know the user needs to give full screen authorization, and I'm sure the browser does not allow you to overload the command to get out of it, whatever it is .

I suggest you "take a step back" and evaluate exactly what problem you are trying to solve ( and not just the imagined solution ).


It is a registration program and the user can not exit the full screen ...

Register on what? Can not get out of full screen why? Is it to solve a technical problem on your site / service / application (and if so, which one?) Or for security reasons? Are there alternatives? It is important that these details are well thought out - and the most appropriate solution employed (whether using native browser features, or using plugins and / or OS-specific functionality). Well in the general case the only correct answer to your question is: "it is impossible to completely block the keyboard in jQuery".

10.05.2014 / 16:54