coderef

BeaconsBaseline · Widely available

The navigator.sendBeacon() method asynchronously sends an HTTP POST request with a limited amount of data, typically for app state, events, and analytics data. The one-way beacon is guaranteed to be initiated before the browser unloads the page, but the sender does not get to handle the response.

Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Apr 12, 2018. Widely available since Oct 12, 2020.

Browser support

DesktopChrome
1–38Not supported
39+Supportedsince Nov 18, 2014
Current: 155
Edge
12–13Not supported
14+Supportedsince Aug 2, 2016
Current: 154
Firefox
1–30Not supported
31+Supportedsince Jul 22, 2014
Current: 157
Safari
1–11Not supported
11.1+Supportedsince Apr 12, 2018
Current: 27
MobileChrome Android
18–41Not supported
42+Supportedsince Apr 15, 2015
Current: 155
Firefox Android
4–30Not supported
31+Supportedsince Jul 22, 2014
Current: 157
Safari iOS
1–11Not supported
11.3+Supportedsince Mar 29, 2018
Current: 27

How to use

This feature is Baseline widely available — use it freely, no fallback needed.

Example

Full syntax and examples are on MDN: sendBeacon.

Feature detection

JS · check before using
if ("Navigator" in globalThis && "sendBeacon" in Navigator.prototype) {
  // Navigator.sendBeacon is available
}

Documentation (MDN)

Specification

Usage share