Language
English English Vietnamese (Tiếng Việt) Vietnamese (Tiếng Việt) Chinese (简体中文) Chinese (简体中文) Portuguese (Brazil) (Português do Brasil) Portuguese (Brazil) (Português do Brasil) Spanish (Español) Spanish (Español) Indonesian (Bahasa Indonesia) Indonesian (Bahasa Indonesia)
Window Focus Tester

Window Focus Tester

See in real time when your window has focus, loses focus, or its tab is hidden, with live timers, counters and a full event log.

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

Write focus- and visibility-aware code — pausing videos, throttling network polling, stopping animations, or saving state when a tab is no longer in view.

Measure Your Focus

Track how often you switch away from a page. Watch focus, blur, and visibilitychange events fire live with exact browser-reported values.
How it works: Instead of guessing how browser focus events behave, you can watch them fire live, see the exact values the browser reports, and review a timestamped history of every change.

How to Use the Tool

Follow these steps to start measuring your window focus and visibility states in real time:

1

Open the Tool

Look at the large status banner — it starts in the Focused state, confirming the tool is active and detecting your window.

2

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.

3

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.

4

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.

Session controls: Use the Clear button to empty the event log, or Reset to zero every counter and start a brand-new measuring session.

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"?

Unfocused

Window Lost Focus

  • You clicked another application
  • The tab is still visible on screen
  • Page content remains in view
Hidden

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.

Session time 00:00
Focused
This window currently has focus and is visible.
00:00

Switch to another tab or click another window to watch focus, blur and visibility events tracked in real time.

00:00
Time focused
00:00
Time away
0
Times unfocused
0
Tab switches
00:00
Longest focus
document.hasFocus() true
document.visibilityState visible
Event log
No events yet — leave or return to this window to record events.
Click another application window to trigger the Unfocused state
Switch tabs or minimize the window to trigger the Hidden state
Watch the raw readout to see the live document.hasFocus() and document.visibilityState values
Press Reset to zero every counter and start a fresh session
Everything runs locally in your browser — no data is sent anywhere
Want to learn more? Read documentation →
1/6
Can't find it? Build your own tool with AI
Start typing to search...
Searching...
No results found
Try searching with different keywords