← Wed, Nov 25 digest

Bypassing iOS Safari's 60 FPS Limit to Build Web Applications That Feel Native

read article ↗ hn thread ↗

A developer discovered a workaround combining compositor-driven scroll elements and OffscreenCanvas to bypass iOS Safari's 60 FPS limit, achieving true 120 Hz web apps.

read it A deep technical breakdown of how to squeeze 120 Hz input and rendering out of iOS Safari using scroll-driven controllers and OffscreenCanvas.

summary

iOS Safari limits web apps to 60 FPS on 120 Hz screens unless hidden system flags are enabled. To bypass this restriction, the author engineered a system using invisible scrollable containers that leverage the browser's compositor thread for high-frequency input tracking. They then combined this with OffscreenCanvas to push frames directly from workers, forcing WebKit to render at the full device refresh rate. While successful, the technique is a clever hack that increases battery draw and relies on internal WebKit behaviors that Apple could change at any time.

key points

  1. iOS Safari caps touch events and requestAnimationFrame at 60 Hz on ProMotion displays, restricting web apps from feeling native.
  2. Invisible scroll containers allow developers to extract high-frequency position data via the browser's compositor thread instead of relying on slow JS events.
  3. Creating an OffscreenCanvas tricks WebKit into bypassing the main-thread rendering pass, enabling true 120 FPS canvas rendering.

who should read it

Frontend engineers and web performance specialists looking to optimize mobile web application frame rates.

discussion positive

consensus

Commenters are highly impressed by the technical ingenuity of the workarounds and how smooth the demos feel, though some users with ProMotion devices noted difficulty perceiving the difference.

pushback

Skeptics point out that forcing 120Hz rendering drains battery heavily and relies on brittle WebKit behaviors that Apple might patch or break in future updates.

best comment by afavour ↗

In case you’re wondering “why isn’t 120fps enabled by default”: on the native side iOS selectively enables it for transitions that cover a lot of the screen. If you use SwiftUI or UIKit it’s done for you but there are switches on CAAnimation (IIRC) that control it.

The web has no equivalent. So it’s all 120hz all the time, or not. And that would drain the battery more than Apple would like.

Clarifies Apple's internal heuristics for 120Hz transitions in native apps and why the lack of a web equivalent creates battery trade-offs.

Generated by an LLM from the article and thread. Check the sources before relying on it.