Skip to Content
Platform.Ontology

requestAnimationFrame timing

Runs code before each screen refresh, and reveals the display's refresh rate.

Gets silentlySpeed and timingFrame pacingWeb browsersWhile you use it

In one line

Can run code before each screen refresh and learn your refresh rate

Runs code before each screen refresh, and reveals the display's refresh rate.

A site can learn your monitor's refresh rate (60, 120, 144 Hz) by counting frames, and can tell when the tab is hidden because callbacks stop. It is the core of smooth animation.

What it can and can't do

What the user does: Nothing. It happens when the page shows animation

It can

  • Run smooth animations and games
  • Count frames to learn your screen runs at 60, 120 or 144 Hz
  • Tell when the tab is hidden, since the calls pause

It cannot

  • Run while the tab is hidden in most browsers
  • Ask permission first
  • See your files
  • Know who you are by itself

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported242013-01-10None
EdgeSupported122015-07-29None
FirefoxSupported232013-08-06None
SafariSupported72013-10-22None
Safari on iPhoneSupported72013-09-18All iOS browsers use WebKit
Chrome on AndroidSupported252013-02-27None
Samsung InternetSupported1.52013-09-25None

How a site asks for it

APIrequestAnimationFrame(cb); cb(timestamp)
Browser compat keysapi.Window.requestAnimationFrame
api.Window.cancelAnimationFrame
How access is grantednone
What the user seesNone (no browser prompt)
Needs a secure context (HTTPS)No
Needs a user gestureNo
Activationnone
How long it lastsPer page; callbacks run once per display refresh while the tab is visible
How to take it backNothing to revoke (no permission is stored)
Inside an iframePer frame; hidden iframes stop receiving callbacks

Typical flow

  1. Page calls requestAnimationFrame
  2. Browser calls back before the next paint
  3. Page reads the DOMHighResTimeStamp argument

Data you get

Shape: none

No individual data fields. The signal is the access itself.

Technical limits

  • Callbacks pause entirely in background tabs and hidden iframes in all major browsers (no hidden polling)
  • Frame rate follows the display: 60 Hz gives about 16.7 ms between callbacks, 120 Hz gives about 8.3 ms
  • Safari on iOS in Low Power Mode drops callbacks to about 30 fps
  • Timestamps are rounded like performance.now() (coarse, with jitter)
  • No access to the exact refresh rate; it must be measured

The story

What it is

A page runs code right before each screen refresh, which also reveals your display's refresh rate.

For you

You never see a prompt. It is why animations and games look smooth. When you switch tabs, the browser pauses it to save power. It also shows how fast your screen refreshes.

For makers

It is the heartbeat of every browser game and animation. It lets code draw in time with the screen and pause when hidden. The timing also reveals the refresh rate, which is a small device clue.

Where you see it

TypeExampleApps
gamesA browser game like Krunker.io calls it every frame to move players and draw the scene.Krunker.io, Slither.io
creativeA design tool redraws only when needed, in step with the screen, so panning stays smooth.Figma, Excalidraw
mapsA web map redraws tiles and labels in each frame while you drag.Google Maps, Mapbox
videoA video player draws overlays like subtitles in time with each frame.None named
adsAn ad script uses frame timing to check the ad was truly on screen and not hidden in a background tab.None named
securityA bot detector sees that frames never run, a sign of a hidden or headless browser.None named
educationA science site animates a simulation, like planets in orbit, smoothly at the screen's speed.None named

Risks

  • Reveals refresh rate
  • Can reveal hidden tabs

What the platform says

Good uses and abuse

Legitimate uses

  • Animation and games
  • Canvas and WebGL rendering
  • Scroll linked effects

Known abuse

  • Refresh rate fingerprinting
  • Detecting hidden tabs or low power mode

Scores

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

History

  • 2013-01, Chrome 24: Unprefixed requestAnimationFrame
  • 2013-08, Firefox 23: Unprefixed requestAnimationFrame

Sources

How well checked: Based on official documentation.

On this page