I am trying to catch focus in and focus out on the entire web page. I am using:
function focus_in(){
console.log("focus");
}
function focus_out(){
console.log("blur");
}
window.addEventListener("focus", focus_in, false);
window.addEventListener("blur", focus_out, false);
and it is working well on Chrome. However on Windows 7 with IE 11 10 the focus event is being followed by an unwanted blur event.
I have tried:
window.onfocusout = focus_out
window.onfocusin = focus_in
So apparently the debug window (console) is gaining focus whenever it is being written on, so whenever I wrote focus on the console it immediately lost focus as well.