I have an exam application where we would like to prevent users from changing tabs or opening new tabs during the exam as a security measure. Can you suggest ways to achieve the same?
3 Answers
I don't think its possible and pupils could have other web browsers installed anyway or use a smartphone, a tablet, another computer... to browse the web.

- 1,364
- 8
- 22
-
You are right. But, we would like to make it as challenging as possible for them by disabling options change tabs/open a new tab in the same browser. – Adharsh Apr 28 '20 at 04:58
-
1@Adharsh I would say that the tiny bit of resistance that you can add is not worth the time and effort you put in to developing the feature. Whatever obstacles you put in the way are so easy to overcome that it's not worth it. The focus should be more on devising questions that aren't easily solvable with an internet search. – Kurt Hamilton Apr 28 '20 at 05:45
I don't think is possible to avoid open new tabs or windows. However, you can check if your app has the user's focus.
There is a detailed answer about this topic and browser's compatibility here Is there a way to detect if a browser window is not currently active?
You could achieve this by creating a desktop application that hosts a browser. Not as complex as it might seem but it requires a different tech stack. Furthermore, it obviously requires installation on clients which might not be feasible in your use case. One option out of many would be:
- Create a WPF application
- Force it to stay on top, i.e. WPF always on top
- Add Chromium as webbrowser: Chromium
- Implement some custom behavior, such as opening the test page on startup, etc.
Assuming the tech stack is known I would estimate it can be done within a couple of hours including testing. The solution also gives you a bit of additional control, i.e. over browser caching which you could disable...

- 12,706
- 7
- 61
- 97