Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I want to create online exam application, where in i want to develop functionality like while user is taking exam, user cannot switch to other window or browser tab.If he does then exam should commit automatically.
This i want to develop using Angular 2+ or Jquery Or asp.net.

can any one help me to develop or any link regarding this.

What I have tried:

I want to create online exam application, where in i want to develop functionality like while user is taking exam, user cannot switch to other window or browser tab.If he does then exam should commit automatically.
This i want to develop using Angular 2+ or Jquery Or asp.net.

can any one help me to develop or any link regarding this.
Posted
Updated 14-Jul-19 21:19pm

1 solution

You can't prevent it, not at all. Doesn't matter what language you use, the user can always switch away from your page - be it to another page, a different app, or even a different instance of the same browser.

Think about it: if you could do that, so could malicious websites. Do you really want a ransomware or similar site preventing you from switching away from it?
 
Share this answer
 
Comments
jayant812 15-Jul-19 3:48am    
Ok thats fine we can't prevent, but i need some thing if user switch window then user should automatically logged out from the exam.
OriginalGriff 15-Jul-19 3:57am    
You are over to Javascript, and the Blur and Focus events, or something like the Visibility API:
https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API?redirectlocale=en-US&redirectslug=DOM%2FUsing_the_Page_Visibility_API

Do not expect this to be easy; do not expect the same code to work the same on all browsers ...

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