Detect browser out of focus

41 views Asked by At

I want to detect when the browser goes out of focus. More specifically, here is my case:

I have my page opened and when I change the tab, it can be detected using visibilitychange. But when I go to another app, ex: VS Code without specifically minimizing the browser window or changing the tab, it does not work.

Here is a representation:

  • A->my current tab where I want the change to be detected.
  • I go to tab B, the change is detected.
  • I come back to A and then without minimising the browser, I go to VS Code the change is not detected.
  • I go back to tab A, then to tab B and then go to VSCode, the change gets detected.
0

There are 0 answers