Skip to Content
Platform.Ontology

Page Visibility, focus and blur

Tells a page when its tab is hidden, backgrounded or unfocused.

Gets silentlySpeed and timingAttentionWeb browsersWhile you use it

In one line

Can tell when you switch tabs, minimise the browser or lock the screen

Tells a page when its tab is hidden, backgrounded or unfocused.

Sites learn when the person switches tabs, minimizes or locks the screen. Used for attention tracking, exam proctoring and ad viewability, and by bot detectors that expect focus events.

What it can and can't do

What the user does: You switch tabs, minimise the window or lock the screen

It can

  • Learn when the tab is shown or hidden
  • Learn when the window loses focus
  • Time how long you look at an ad or a page
  • Check that you are really there, as exam tools and bot checks do

It cannot

  • See what you do in other tabs or apps
  • Ask permission first
  • Know why you left
  • Stop you from switching away

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported332014-02-20None
EdgeSupported122015-07-29None
FirefoxSupported182013-01-08None
SafariSupported72013-10-22None
Safari on iPhoneSupported72013-09-18None
Chrome on AndroidSupported332014-02-26None
Samsung InternetSupported2.02014-10-17None

How a site asks for it

APIdocument.visibilityState; visibilitychange; window focus/blur; document.hasFocus()
Browser compat keysapi.Document.visibilityState
How access is grantednone
What the user seesNot listed
Needs a secure context (HTTPS)No
Needs a user gestureNo
How long it lastsNot listed
How to take it backNot listed
Inside an iframeNot listed

Typical flow

  1. Listen to visibilitychange and focus
  2. Log timestamps
  3. Compute attention time

Data you get

What comes back: State transitions
Shape: event

FieldTypeUnitRangePrecision
visibilityStatestringNonevisible, hiddenexact

Technical limits

  • Cannot see which other tab or app
  • Background timers throttled to 1 per second then 1 per minute

The story

What it is

A page can tell when its tab is hidden, in the background or when you click away from it.

For you

You never see a prompt. A video may pause when you switch tabs, a game may stop, and a site may notice you went away. It is how pages save battery, and how some sites know you looked elsewhere.

For makers

Makers use it to pause video, stop animations and save power. It also powers ad viewability, which only counts an ad when the tab is visible, and some exam and training sites flag tab switches.

Where you see it

TypeExampleApps
videoA video site pauses when you switch tabs, then resumes when you return.YouTube, Netflix
gamesA browser game pauses the match when you switch away, so you do not lose while away.None named
adsAn ad measurement script only counts an ad as seen when the tab is visible and in view.DoubleVerify, Integral Ad Science
educationAn online exam tool records each time a student leaves the test tab.Proctorio, ExamSoft
messagingA web chat app only sends a read receipt when the tab is visible, and sends a notification when it is hidden.Slack, WhatsApp Web
liveA live stream stops loading video chunks in a hidden tab to save data and power.Twitch
analyticsA site measures true time on page by pausing the timer when the tab is hidden.Google Analytics

Risks

  • Can feel like monitoring
  • Exams may flag honest tab switches

What the platform says

Good uses and abuse

Legitimate uses

  • Pausing media, saving battery

Known abuse

  • Attention and engagement tracking, proctoring

Scores

ScoreValueMeaning
Sensitivity2 of 5How revealing the data is
Utility2 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bits2Rough identifying entropy, when known

Sources

How well checked: Based on official documentation.

On this page