Click here to Skip to main content
15,912,897 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I want to disable alt-tab, alt-f4, windows key of the client machine that is accessing my website.. so that the user is not able to navigate to other windows?
I am able to disable these keys but at the server because the keyboard hook is created on the machine where the code is being executed.Please help.
Posted
Updated 14-May-11 3:16am
v2

I'd look at the structure of your app if you want to do this, doing this in a meaningful way is not as easy as it looks.
I did this for a government website and strapping down all of the keystrokes for all of the browsers (for example there is little point in stopping Alt-F4 if you don't block the back/forward buttons). Not only that, but you have to force the browser to hide the address bar to prevent the user from navigating away in this manner. A lot of people (uncluding myself) wouldn't be happy navigating a website like this.

If you must do this, you need to do it in the browser using javascript, the principle is easy enough: handle the keypress/ keydown events for the document, and return false for the keystrokes you want to supress. This[^] has something to get you started. As I said above, it isn't as simple as disabling the keystrokes you mentioned, and users won't like it.

[Edit in response to OP's comment]
What you are asking for is practically impossible, I kind of alluded to this in my own English-type way in my original reply. Even if you strap the relevant keystrokes down, the likiehood is there will some you miss and there are some you just can't block anyway. This problem becomes worse if you have to strap down several browsers.

If the exam takes place on a user's PC, and you acheieve what you want, you are effectively locking the user out their own system: this is extremely bad. They can also just fire up another browser on another machine.

If the machine is in a lab, it is better to restrict the user's internet access solely to your exam site and block the user from getting to the command prompt.

There are other strategies you could consider(especially for lab-based exams), but in my view whatever your company needs, it needs a serious re-think.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 14-May-11 18:20pm    
Practically impossible. Ctrl+Alt+Del cannot be blocked/disabled.
Kiosk mode is what probably required.
Please see my answer.
--SA
Neeta nnkk 30-May-11 5:13am    
Thanks Keith, but the thing is I am not able to supress the keystrokes using javascript. Reason being windows and alt-tab are special keys that are handled by the operating system, javascript is not able to capture these keystrokes. I want to restrict users coz mine is an online exam system. Navigational restrictions are needed.
Keith Barrow 30-May-11 10:29am    
I've updated my original answer, sorry I can't be more positive. One strategy you could consider is an open-book exam, but these need to be carefully structured and agreed on by whoever set them, it also makes the system less useful overall.
What are your trying to do is pretty much useless. In particular, there is not way to disable effect of Ctrl+Al+Del, whatever your do — by apparent safety reasons.

What you're looking for is Kiosk Mode.
See:
http://en.wikipedia.org/wiki/Internet_kiosk[^],
http://support.microsoft.com/kb/154780[^],
http://digital.ni.com/public.nsf/allkb/DF357CDA59091AE6862576CF005EE86B[^],
http://jaredheinrichs.com/how-to-turn-a-windows-7-pc-into-a-kiosk.html[^],
http://fmforums.com/forum/topic/76770-kiosk-mode-on-windows-7/[^].

—SA
 
Share this answer
 
Comments
Neeta nnkk 30-May-11 5:22am    
thanks SA, I am not able to find any means to disable ctrl+Alt+Del but I want to restrict my users from navigating to any other site or application while my application is running. Mine is an online exam system, so restricting the users becomes needful..
Sergey Alexandrovich Kryukov 30-May-11 15:08pm    
Well, get to Kiosk mode then.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900