Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dojo: What event fires when the page/window loses focus?

In the javascript framework Dojo, is there an event that fires when the entire page loses focus?

If there is no event fired, is there another way to track the window losing focus? I want to be able to tell when someone clicks away from the page so that i can log the action (its an educational project, we're monitoring students actions for patterns and such).

like image 217
Dfowj Avatar asked Dec 22 '22 00:12

Dfowj


1 Answers

Yes, this is commonly known as the blur event.

This can be done in straight JavaScript, no need for Dojo here:

window.onblur = function() {
   //do something here...
};
like image 106
Jacob Relkin Avatar answered Feb 04 '23 05:02

Jacob Relkin