Last updated on
TIL

Detect if the tab is hidden or visible


Detect if the document is currently hidden (which means, not active. e.g. user currently has a different tab open)

document.hidden

https://developer.mozilla.org/en-US/docs/Web/API/Document/hidden