I just learned about onfocusout
, onfocusin
but these functions do not seem to work. I tried it both with firefox and chrome. There are no console messages at all, even when i have focus and loose it. What am i doing wrong?
window.addEventListener
(
"onfocusout",
function()
{
console.log("page lost focus");
}
);
window.addEventListener
(
"onfocusin",
function()
{
console.log("page has focus");
}
);
<h1>Test</h1>