0

Can I tell if the screen is off vs the browser is minimized or tab has been changed with js?

I want to be able to run a function when the user has done something on his phone that was not on my page aside from turning the screen off.

Basically, I want to ignore the screen being turned off but run a function when the user minimized the browser app or changed tabs.

Is there such a way to do this with js? or node.js?

How can I tell I trigger different events for screen off vs any other action that removes focus or makes page visibility hidden?

thank you

  • possibly duplicate : https://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active – V. Sambor Nov 02 '18 at 21:28
  • Possible duplicate of [Is there a way to detect if a browser window is not currently active?](https://stackoverflow.com/questions/1060008/is-there-a-way-to-detect-if-a-browser-window-is-not-currently-active) – V. Sambor Nov 02 '18 at 21:29
  • That doesn't help detect the difference between a closed screen and a minimized one/different tab. I want to keep running when the screen is off, even just log it. But completely stop when something else is done on the phone. – Itamar Kamar Nov 03 '18 at 09:59

0 Answers0