W3cubDocs

/Web APIs

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.

js

if ("serviceWorker" in navigator) {
  // Supported!
}

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

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Navigator/serviceWorker