What Is the Window Focus Tester?
The Window Focus Tester shows, in real time, whether your browser window is the active window, whether it has lost focus to another application, or whether its tab is currently hidden. It combines the browser's focus and blur events with the Page Visibility API to give an accurate, moment-by-moment picture of how your window is being used.
Built for Developers
Measure Your Focus
focus, blur, and visibilitychange events fire live with exact browser-reported values.- 1. What Is the Window Focus Tester?
- 2. How to Use the Tool
- 3. Features
- 4. Frequently Asked Questions
- 4.1. What is the difference between "Unfocused" and "Hidden"?
- 4.2. Why does opening DevTools change the state to Unfocused?
- 4.3. Why do I sometimes see two log entries for one tab switch?
- 4.4. Are the timers accurate when the tab is in the background?
- 4.5. Does the tool keep my data after I close the page?
How to Use the Tool
Follow these steps to start measuring your window focus and visibility states in real time:
Open the Tool
Look at the large status banner — it starts in the Focused state, confirming the tool is active and detecting your window.
Switch to Another App
Click another application window while keeping this tab on screen. The banner turns to Unfocused — the window lost focus but the tab remains visible.
Hide the Tab
Switch to a different browser tab or minimize the window. The banner turns to Hidden, reflecting that the tab is no longer visible.
Return to the Tab
Come back to see the state change to Focused and a new entry appear in the event log with a precise timestamp.
Live Stats & Controls
As you interact, the stat cards update live with the following metrics:
- Total time focused and total time away
- Number of times you left focus
- Number of tab switches
- Your longest uninterrupted focus streak
The raw readout below the cards shows the exact live values of document.hasFocus() and document.visibilityState at every moment.
Features
The Window Focus Tester combines multiple browser APIs into a single, unified view of your window's state.
Three-State Detection
Reliably detects Focused, Unfocused, and Hidden states using document.hasFocus() and document.visibilityState, regardless of the order events fire.
Live Timers
Total focused time and total away time update continuously, alongside a timer for the current state and one for the whole session.
Independent Counters
Window focus losses and tab switches are tracked separately — a click to another app is clearly distinguished from a tab switch.
Longest Focus Streak
Records and updates your longest uninterrupted period of focus in real time.
Raw API Readout
Displays the live boolean and string values returned directly by the underlying browser APIs for full transparency.
Event Log
Every state change is logged with a timestamp and the duration of the previous state, displayed newest entry first.
Your Data Stays Private
All detection runs entirely in your browser — no data ever leaves your device.
- No uploads — nothing is sent to any server
- No tracking — your activity is never collected or stored
Frequently Asked Questions
What is the difference between "Unfocused" and "Hidden"?
Window Lost Focus
- You clicked another application
- The tab is still visible on screen
- Page content remains in view
Tab Not Visible
- You switched to another browser tab
- Or the browser window was minimized
- Page content is no longer in view
Why does opening DevTools change the state to Unfocused?
When DevTools takes keyboard focus, document.hasFocus() returns false even though the page is still on screen. The tool reports this accurately as the Unfocused state — this is expected browser behavior, not a bug.
Why do I sometimes see two log entries for one tab switch?
Some browsers fire the blur event before the visibility change. In that case, the window first becomes Unfocused and then Hidden, so both transitions are recorded. The counters still increment correctly — once for leaving focus and once for the tab becoming hidden.
Are the timers accurate when the tab is in the background?
Yes. Times are calculated from timestamps rather than from a running counter, so the background throttling that browsers apply to timers does not affect the totals. You always get accurate elapsed time regardless of tab visibility.
Does the tool keep my data after I close the page?
No. Each visit starts a completely fresh session. Nothing is saved to local storage, cookies, or any external server — your data is gone the moment you close or refresh the page.
No comments yet. Be the first to comment!