web-feature: Page visibility
The document.visibilityState and document.hidden properties tell you whether the page is visible to the user (for example, it’s not minimized or in a background tab).
The document.visibilityState and document.hidden properties tell you whether the page is visible to the user (for example, it’s not minimized or in a background tab).