0

I want to spare browsers from unnecessarily acquiring resources when my web page is shown in a non-active tab or hidden by another program window (= inactive).

Which events to I need to subscribe to in order to recognize when my web page is (in)active, or (in)visible?

AxD
  • 2,714
  • 3
  • 31
  • 53

1 Answers1

1

document.hidden ?

Try minimizing your browser and see the logs:

setInterval(function(){console.log(document.hidden)},2000);
ibrahim tanyalcin
  • 5,643
  • 3
  • 16
  • 22
  • Thanks for trying the help! :) The above mentioned Page Visibility API seems to be what I'm looking for. – AxD Apr 19 '18 at 20:36