--- title: ServiceWorkerRegistration.active slug: Web/API/ServiceWorkerRegistration/active translation_of: Web/API/ServiceWorkerRegistration/active ---
The active
property of the {{domxref("ServiceWorkerRegistration")}} interface returns a service worker whose {{domxref("ServiceWorker.state")}} is activating
or activated
. This property is initially set to null
.
An active worker controls a {{domxref("ServiceWorkerClient")}} if the client's URL falls within the scope of the registration (the scope
option set when {{domxref("ServiceWorkerContainer.register")}} is first called.)
Note: This feature is available in Web Workers.
sw = ServiceWorker.active
A {{domxref("ServiceWorker")}} object, if it is currently in an activating
or activated
state.
Specification | Status | Comment |
---|---|---|
{{SpecName('Service Workers', '#service-worker-registration-active-attribute', 'ServiceWorkerRegistration.active')}} | {{Spec2('Service Workers')}} | Initial definition. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|
Basic support | {{CompatChrome(40.0)}} | {{ CompatGeckoDesktop("44.0") }}[1] | {{CompatNo}} | {{CompatUnknown}} | {{CompatNo}} |
Available in web workers | {{CompatVersionUnknown}} | {{CompatGeckoDesktop("44.0")}}[1] | {{CompatNo}} | {{CompatUnknown}} | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|
Basic support | {{CompatUnknown}} | {{ CompatGeckoMobile("44.0") }} | {{ CompatVersionUnknown }} | {{CompatNo}} | {{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} |
Available in web workers | {{CompatUnknown}} | {{CompatVersionUnknown}} | {{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} | {{CompatNo}} | {{CompatUnknown}} |
[1] Service workers (and Push) have been disabled in the Firefox 45 and 52 Extended Support Releases (ESR.)