Skip to content

fetchLater API #1069

@ErwinHofmanRV

Description

@ErwinHofmanRV

Description

fetchLater() is a Fetch API that lets pages queue a deferred network request the browser will send later (when the document is destroyed, after a specified timeout, or at a UA-chosen time). It’s designed to replace many ad-hoc beacons with a single, reliable, end-of-lifecycle request reducing client requests, backend processing, and associated energy/costs.
It's ideal for bundling events and metrics into a single beacon per page life cycle (TTFB, FCP, LCP) as well as keeping track of and updating events and metrics (INP, CLS, max scrolling position).

Scope includes the JS API, request scheduling/lifecycle, delivery semantics around navigation/unload/bfcache, quotas and policy interactions (e.g., CSP).
Out of scope: changes to unrelated beaconing mechanisms and vendor-specific batching strategies groups.google.com

Specification

https://fetch.spec.whatwg.org/#dom-window-fetchlater

web-feature

https://web-platform-dx.github.io/web-features-explorer/features/fetchlater/

Test Links

https://wpt.fyi/results/fetch/fetch-later

Additional Signals

Standards Positions

  • Mozilla (Gecko): Standards-positions issue shows positive stance and tracking; implementation bug filed. github.com/mozilla

  • WebKit (Safari): Standards-positions issue and WebKit bug tracking implementation. github.com/WebKit

  • TAG design review: Issues addressed in TAG review. github.com/w3ctag

Site Breakage and Workaround

  • Replaces fragile unload-time patterns (beforeunload/pagehide with sendBeacon/fetch keepalive) with a reliable UA-scheduled request, reducing lost telemetry and script complexity. Chrome origin Trial write-up details motivation and the migration benefits vs. current workarounds.

Size and Current State of the Feature

  • API surface is intentionally small: window.fetchLater() returning FetchLaterResult { activated }, with quotas and CSP integration. MDN and explainer document behavior and constraints (e.g., bodies can’t be ReadableStream).

Browser / Engine Status

  • Chromium: Origin Trial in 121–126, Intent-to-Ship landed; shipping on desktop/Android around M134; WPTs promoted (tentatives removed) after spec merge.

  • Gecko & WebKit: Positions filed and implementation bugs open; no stable support yet.

Browser Bugs

Developer Surveys / Other Developer Sentiment

Likely Compatibility Impact

  • Low risk: new opt-in API; response is intentionally ignored; pending requests flush on bfcache entry for privacy; adheres to CSP and quotas. Interop risks mainly around timing/activation semantics and quota policy—covered by WPT.

Platform Impact

  • Web: Simplifies beaconing, reduces request count, and improves reliability of telemetry delivery.

  • Servers: Fewer, batched requests reduce processing and costs.

  • Sustainability: Fewer network round-trips and consolidated processing can reduce energy footprint relative to many small beacons.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions