SharedWorker
A background script that all tabs of a site share, so one process keeps state across them.
In one line
Can run one background script shared by all open tabs of the site
A background script that all tabs of a site share, so one process keeps state across them.
Lets a site keep one connection and a single cross-tab state, which also shows how many tabs the person has. Partitioned like other storage in modern browsers, so a tracker cannot join sites with it.
What it can and can't do
What the user does: Nothing. It happens while you have the site open in more than one tab.
It can
- Keep one connection or one copy of data for all tabs
- Do work away from the page so it stays smooth
- Pass messages to each open tab
It cannot
- Keep running after you close every tab of the site
- Reach tabs from other sites
- Change the page's content directly
How it differs between platforms: Most computer browsers support it. Chrome on Android and Samsung Internet only partly do.
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 5 | 2010-05-25 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Supported | 29 | 2014-04-29 | None |
| Safari | Supported | 16 | 2022-09-12 | None |
| Safari on iPhone | Supported | 16 | 2022-09-12 | None |
| Chrome on Android | Partial | 148 | 2026-05-05 | Support on Android arrived recently (verify) |
| Samsung Internet | Partial | Not available | Not listed | Unverified |
How a site asks for it
| API | new SharedWorker(url) |
| Browser compat keys | api.SharedWorker |
| How access is granted | none |
| What the user sees | None |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | While at least one connected page is alive |
| How to take it back | Clear site data, browser privacy settings |
| Inside an iframe | Not listed |
Data you get
What comes back: Port messages
Shape: event
How often: live
No individual data fields. The signal is the access itself.
Technical limits
- Same origin and partition
- Ends when the last page disconnects
- Chrome on Android support came late (verify)
The story
What it is
A background script that every tab of a site shares, so one process keeps state across them.
For you
You never see it. It is why a chat site can keep one live connection for all your open tabs, saving battery and data.
For makers
It lets one connection or one heavy job serve every tab. Makers save servers and battery. It also means one hidden script can see what all tabs of the site do.
Where you see it
| Type | Example | Apps |
|---|---|---|
| messaging | A web chat opens one live link for all tabs so you do not get duplicate messages. | Slack |
| games | A browser game that is open in two tabs keeps one network link and one game state. | None named |
| productivity | A web app does one background sync for all open tabs of a document. | None named |
| shopping | A store keeps one live price feed shared across tabs. | None named |
| live | A live score or stock page uses one feed shared across tabs. | None named |
| analytics | A site script collects events from every tab in one place. | None named |
Risks
- Hidden background code
- Safari support is recent
What the platform says
- MDN: SharedWorker. Documents a script that runs in the background and can be used by many tabs of the same site.
Good uses and abuse
Legitimate uses
- Shared connection, cross-tab coordination
Known abuse
- Cross-site state hub before partitioning
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 1 of 5 | How revealing the data is |
| Utility | 3 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | Not rated | Rough identifying entropy, when known |
History
- 2022-09, Safari 16: Shipped in Safari
- 2023-07, Chrome 115: Partitioned by top level site
Related capabilities
Related
- BroadcastChannel. Can send messages between open tabs and frames of the same site
Sources
How well checked: Based on official documentation.