Push, periodic sync and background fetch
Ways a site can wake its service worker after the person leaves: push messages, timed sync, long downloads.
In one line
Can wake a site's background script after you leave, through push, timed sync or downloads
Ways a site can wake its service worker after the person leaves: push messages, timed sync, long downloads.
Push needs a notification permission; Periodic Background Sync needs an installed PWA and site engagement, with a minimum of about 12 hours between wakes; Background Fetch shows a download notice. Each lets a site run code with no tab open.
What it can and can't do
What the user does: You allow notifications, install a web app, or start a big download
It can
- Wake the site through a push message once you allow notifications
- Refresh an installed web app about once every 12 hours or more
- Run a large download that shows a progress notice
- Run site code with no tab open for a short time
It cannot
- Use push without your notification permission
- Use timed sync unless the site is installed and you use it often
- Run in the background without limits, since browsers stop it after a short time
- Work the same in Safari and Firefox, which support less
How it differs between platforms: Chrome and Edge support all three. Firefox and Safari, including iPhone browsers, support only some.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 42 | 2015-04-14 | Push 50, periodic sync 80 for installed PWAs |
| Edge | Supported | 17 | 2018-04-30 | None |
| Firefox | Partial | 44 | 2016-01-26 | Push only |
| Safari | Partial | 16 | 2022-09-12 | Push in macOS Safari 16 |
| Safari on iPhone | Partial | 16.4 | 2023-03-27 | Push only for Home Screen web apps |
| Chrome on Android | Supported | 42 | 2015-04-15 | None |
| Samsung Internet | Supported | 4.0 | 2016-03-11 | None |
How a site asks for it
| API | PushManager.subscribe(), registration.periodicSync.register(), registration.backgroundFetch.fetch() |
| Permission name | push |
| Browser compat keys | api.PushManagerapi.PeriodicSyncManagerapi.BackgroundFetchManager |
| How access is granted | prompt |
| What the user sees | None |
| Needs a secure context (HTTPS) | Yes |
| Needs a user gesture | No |
| How long it lasts | Subscriptions last until the person unsubscribes, clears data, or the push service expires them |
| How to take it back | Clear site data, browser privacy settings |
| Inside an iframe | Not listed |
Data you get
What comes back: Push or sync events
Shape: event
How often: at wake
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
min_interval | integer | hours | about 12 for periodic sync | approximate |
Technical limits
- Push requires notification permission
- Periodic sync minimum about 12 hours and only for installed PWAs (Chrome)
- Silent push is not allowed: Chrome and Safari require a user visible notification
- Safari push only for Home Screen web apps on iOS
The story
What it is
Several ways a site can wake its background script after you leave: push messages, timed syncs, long downloads.
For you
After you leave the page, the site may still run small bits of code when it gets a push, a timed sync or a download event. You mostly see a notification or fresher content on return.
For makers
Makers use these to stay in touch, keep apps fresh and finish work after the tab closes. They are also a way for a site to run code you did not open. Browsers limit it by permission and by how often you use the site.
Where you see it
| Type | Example | Apps |
|---|---|---|
| messaging | A web chat wakes on push and shows a new message, so you do not have to open the page. | Slack |
| news | A news app wakes on a timer to load the latest stories before you open it. | None named |
| video | A streaming web app finishes a movie download after you close the tab. | None named |
| games | A browser game wakes on push to tell you a match is ready. | None named |
| ads | An ad network wakes a site's background script to show a promo notice. | None named |
| analytics | A site wakes in the background to send queued usage data it could not send before. | None named |
| security | A bank wakes on push to show a login approval prompt. | None named |
Risks
- Runs after you leave
- Spam and tracking use
What the platform says
- MDN Web Docs: Push API. Lets a server send messages that wake the web app, even when it is closed.
Good uses and abuse
Legitimate uses
- Order updates, offline sync
Known abuse
- Re-engagement spam, hidden background work
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 4 of 5 | How revealing the data is |
| Utility | 4 of 5 | How useful it is to honest apps |
| Friction | 2 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2016-04, Chrome 50: Web Push shipped
- 2019-02, Chrome 74: Background Fetch shipped
- 2020-02, Chrome 80: Periodic Background Sync for installed PWAs
- 2023-03, Safari 16.4: Web Push for Home Screen web apps and macOS Safari
Related capabilities
Related
- Service worker lifetime. Can keep a background helper script for a site that stays after you close the tab
Sources
How well checked: Based on official documentation.