oddworks blog

Page Visibility API test: check what a site sees when you leave

On this page
  1. What the test page measures
  2. The six tiles
  3. The event log
  4. Run it: what each action should show
  5. Test a fix or an extension
  6. The fingerprint check
  7. What the test can't show
  8. Build your own quick check
  9. FAQ

To test what a website sees when you leave its tab, open focus.oddworks.us/test, switch to another tab or app for a few seconds, then come back. The page logs every visibilitychange, window blur and window focus event it received, with the time, and shows the current visibilityState, document.hidden and document.hasFocus(). Anything in that log is something any site could have recorded about you.

The page is free and needs nothing installed. Below is what each part shows, what results to expect, and how to read them.

What the test page measures

The page uses the same standard browser features a real site would. In its script it does exactly four things to watch you:

  1. Listens for visibilitychange on the document.
  2. Listens for blur and focus on the window.
  3. Reads document.visibilityState, document.hidden and document.hasFocus() every 500 milliseconds.
  4. Draws a canvas image, a WebGL image and an offline audio signal once per page load and hashes each result, to show how a site can fingerprint your device.

It doesn't check requestAnimationFrame timing, pagehide or mouseleave, so a clean result here doesn't cover those. Our Page Visibility API explainer covers what each property means.

The six tiles

Across the top are six tiles.

Tile What it shows Good value
visibilityState visible or hidden visible
document.hidden false or true false
document.hasFocus() true or false true
Canvas hash 8-character hash of a drawn image depends on the check
WebGL hash 8-character hash of WebGL pixels depends on the check
Audio hash 8-character hash of a rendered audio signal depends on the check

The first three tiles each have a status dot and are marked as fine or as a warning, so you can see at a glance whether the page currently thinks it's hidden or unfocused. The audio tile reads "computing…" for a moment while the browser renders the sound. A hash tile shows n/a if your browser doesn't support that feature, and error if the browser threw an error while computing it.

The event log

Under the tiles is the event log. Each entry has a time (24-hour clock), a type and a message. The newest entry is at the top, so read it bottom to top to follow the order things happened.

Type Message What happened
System Waiting. Switch tabs or minimize the window to test. The page loaded and started listening
Focus Window blurred The window lost focus
Focus Window focused The window got focus back
Visibility Visibility: hidden The tab went out of sight
Visibility Visibility: visible The tab came back into view
System Log cleared You pressed Clear

The Clear button empties the log so you can run one check at a time.

Run it: what each action should show

Run these without any extension that changes visibility, so you see the browser's own behavior. Press Clear before each one.

Switch to another tab

Press Ctrl+Tab (Cmd+Option+Right Arrow on a Mac), wait five seconds, and come back. You should see, from bottom to top: Window blurred, Visibility: hidden, then Visibility: visible and Window focused when you return. Switching tabs typically blurs the window a moment before the tab hides.

The times on the "hidden" and "visible" entries are the exact window you were gone. A site can store that gap, which is how pages measure time away.

Click into another app, with the browser still on screen

Put the browser beside another app and click into the other app. You'll get Window blurred and nothing about visibility. The document.hasFocus() tile turns to false while visibilityState stays visible. This is the case the Page Visibility API alone misses, and why sites also listen for blur. MDN's Page Visibility API page makes the same point: blur tells you the user switched windows, not that the page is hidden.

Minimize the window

Minimize the browser and restore it. Expect Window blurred and Visibility: hidden, then the reverse when it comes back.

Cover the window completely

Drag another app's window so it covers the browser entirely. MDN notes that a page can become hidden when it's "entirely obscured by another window", so on some systems you'll see Visibility: hidden here too. Results vary by operating system, which is useful to know if you rely on keeping a window open behind others.

Test a fix or an extension

The page is useful for checking any tool that claims to hide tab switching, including ours. The recommended routine is in the page's "Focus test" box:

  1. Turn the tool on for the test page's tab. Most of them, Focus Spoofer included, reload the tab so they can start before the page's own scripts.
  2. Press Clear.
  3. Switch to another tab, or minimize the window, for a few seconds.
  4. Come back. No Window blurred or Visibility entries means the page saw nothing.

When Focus Spoofer (which we make) is on for the tab, document.hidden stays false, visibilityState stays visible, document.hasFocus() stays true, and visibilitychange and window blur never reach the page, so all three tiles stay on their good values and the log stays empty. It's a free, open-source extension for Chrome, Edge and Brave; details are on focus.oddworks.us.

If a tool passes the tab switch but fails the "click into another app" check, it's hiding visibility but not focus. Many players only check visibility, so that may be enough for you. Our guide on how to disable the Page Visibility API compares userscripts, filters and extensions.

The fingerprint check

The second box, "Fingerprint test", is about a different kind of tracking. The canvas, WebGL and audio hashes come from tiny differences in how your graphics hardware, drivers and audio stack render the same input. Sites combine values like these to recognize a browser without cookies.

  1. With any fingerprint protection off, reload the page a few times. The three hashes stay the same. That stability is what makes them useful for tracking.
  2. Turn Focus Spoofer on for the tab (fingerprint randomization is on by default) and reload. The hashes now change on every load.
  3. If you turned fingerprint randomization off in Focus Spoofer's Settings, they stay the same again, by design.

The randomization is per page load, so the values only change when you reload.

What the test can't show

The page only sees what its own scripts see. As it says at the bottom, other signals exist that no browser extension can hide from every site, such as timing worked out on the server. It also can't tell you whether Chrome's Memory Saver or Edge's sleeping tabs will unload a tab later, which is a separate problem covered in how to prevent a tab from sleeping.

Build your own quick check

To see the same events on any site, open DevTools (F12), go to the Console tab and paste:

const t = () => new Date().toLocaleTimeString();
document.addEventListener('visibilitychange', () => console.log(t(), 'visibility:', document.visibilityState));
window.addEventListener('blur', () => console.log(t(), 'window blur'));
window.addEventListener('focus', () => console.log(t(), 'window focus'));

Then switch away and come back. This listens from the moment you paste it, and only until you reload. Unlike the test page it runs after the site's own scripts, so it shows what the browser sends, not whether an extension hid it from the site.

FAQ

Is the test page safe to use?

Yes. It runs in your browser, listens for standard events and computes three hashes that it shows you on screen. Nothing needs to be installed.

Why does the log show "Window blurred" before "Visibility: hidden"?

Switching tabs usually takes focus from the window a moment before the tab is hidden, so the blur event arrives first. Read the log from bottom to top to see the real order.

Why does visibilityState stay "visible" when I click into another app?

The tab is still on screen, so it isn't hidden. Only focus changed, which is why document.hasFocus() turns false and the log shows "Window blurred".

Can I use the page to test extensions other than Focus Spoofer?

Yes. It uses only standard browser events, so it works the same for any extension, userscript or filter. Turn the tool on for the tab, reload if it needs to, and run the same steps.

Why don't the fingerprint hashes change when I reload?

That's normal without fingerprint protection: the same device produces the same hashes. They only change on each reload when a tool like Focus Spoofer is randomizing them.

Keep reading

Start with the overview: Page Visibility API explained: document.hidden vs visibilityState