coderef

Background syncLimited availability

The background synchronization API registers a service worker callback to run only when the device is no longer offline. You can use this to let users continue using your app while offline and synchronize with a server after reconnecting.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–48Not supported
49+Supportedsince Mar 2, 2016
Current: 155
Edge
12–18Not supported
79+Supportedsince Jan 15, 2020
Current: 154
Firefox
✕Not supportedup to 157
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–48Not supported
49+Supportedsince Mar 9, 2016
Current: 155
Firefox Android
✕Not supportedup to 157
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Firefox, Safari, Firefox Android, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: sync event.

Feature detection

JS · check before using
if ("Permissions" in globalThis && "permission_background-sync" in Permissions.prototype) {
  // Permissions.permission_background-sync is available
}

Sub-features

Support for each part of the feature (11). The overall table above shows when the whole feature works.

Sub-featureChromeEdgeFirefoxSafariChrome AndroidFirefox AndroidSafari iOS
Permissions.permission_background-sync6279✕✕62✕✕
ServiceWorkerGlobalScope.sync_event4979✕✕49✕✕
ServiceWorkerRegistration.sync4979✕✕49✕✕
SyncEvent4979✕✕49✕✕
SyncEvent.SyncEvent4979✕✕49✕✕
SyncEvent.lastChance4979✕✕49✕✕
SyncEvent.tag4979✕✕49✕✕
SyncManager4979✕✕49✕✕
SyncManager.getTags4979✕✕49✕✕
SyncManager.register4979✕✕49✕✕
SyncManager.worker_support6179✕✕61✕✕