Navigator: serviceWorker property
The Navigator.serviceWorker read-only property returns the ServiceWorkerContainer object for the associated document, which provides access to registration, removal, upgrade, and communication with the ServiceWorker.
The feature may not be available in private mode.
Value
Examples
This code checks if the browser supports service workers.
if ("serviceWorker" in navigator) {
}
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
serviceWorker |
40 |
17 |
44In Firefox private windows, the serviceWorker object is undefined. See bug 1320796.
|
No |
27 |
11.1 |
40 |
40 |
44In Firefox private windows, the serviceWorker object is undefined. See bug 1320796.
|
27 |
11.3 |
4.0 |
See also