I was trying to use Visibility API, but it is not working for a child. The minimal example to reproduce:
<script>
document.onvisibilitychange = () => {
console.log(document.visibilityState);
}
if (!window.opener) {
window.open(window.location.href, '_blank');
}
</script>
After that, the parent window still prints "visible"-"hidden", but child prints "hidden" once only on refresh.
It works fine in the latest Opera browser, but not in the Chrome
To be honest, when I came to this minimal reproduce, I'm stuck and have no idea where to dig. Any ideas what could be wrong?