I am making a program that is for a test. it uses a combination of jsp and servlet and using tomcat 7.0 . My requirement is to identify whenever the user switches the tab or opens a new window of the browser, so that he is unable to use any other resources while giving the test. I am planning to start a thread that continuously checks the focus of the user. What is the possible solution ?
Asked
Active
Viewed 108 times
0
-
Possible duplicate of: http://stackoverflow.com/questions/1038643/event-for-when-user-switches-browser-tabs – Sudarshan_SMD Feb 17 '14 at 13:43
-
@Sudarshan_SMD the solution that the above question provides uses frameworks which I don't want to use – user3319299 Feb 17 '14 at 13:48
1 Answers
0
window.onblur works
<script>
window.onblur = function() {
//your code
};
</script>
jQuery implementations:
$(window).blur(function(e) {
// your code
});

Sudarshan_SMD
- 2,549
- 33
- 23