# Page Visibility API Confidence: high Last verified: 2026-05-22 Generation: human_only ## TL;DR The Page Visibility API informs web applications whether a page is visible (active tab) or hidden (background tab). `document.visibilityState` is `'visible'` or `'hidden'`, with the `visibilitychange` event for detecting state transitions. ## Core Explanation Key uses: pausing video/audio playback when hidden, stopping animation loops, throttling API polling, analytics (actual view time vs. idle time). `document.hasFocus()` additionally checks if the window has focus. Combined, these APIs enable battery and resource-efficient web applications. ## Further Reading - [Page Visibility (W3C)](https://www.w3.org/TR/page-visibility/)