I am using visibilitychange event of the browser. The website is for mobiles. So I test it from my mobile.
document.addEventListener('visibilitychange', (e) => {
console.log("visibility changed", e);
})
This could be caused by many different things.
- switching apps back and forth
- force-closing app
- when the screen turns off
Is there any way to detect what behaviour caused visibilitychange listener to get called? I tried e.target and e.srcElement, but in all cases, they seem to be the same. Any ideas?