-
Notifications
You must be signed in to change notification settings - Fork 8k
/
index.md
41 lines (26 loc) · 1.02 KB
/
index.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
---
title: Navigator.serviceWorker
slug: Web/API/Navigator/serviceWorker
---
{{APIRef("Service Workers API")}}
Le **`Navigator.serviceWorker`** est une propriété en lecture seule qui renvoie un objet {{domxref("ServiceWorkerContainer")}}, et qui permet d'accéder à l'enregistrement, la suppression, la mise à jour, et la communication avec les objets {{domxref("ServiceWorker")}} pour le [document associé](https://html.spec.whatwg.org/multipage/browsers.html#concept-document-window).
## Syntaxe
```js
var workerContainerInstance = navigator.serviceWorker;
```
### Valeur
L'objet {{domxref("ServiceWorkerContainer")}}.
## Exemples
Le code ci-dessous vérifie si le navigateur supporte les service workers.
```js
if ("serviceWorker" in navigator) {
// Supported!
}
```
## Spécifications
{{Specifications}}
## Compatibilité des navigateurs
{{Compat}}
## Voir aussi
- [ServiceWorker API](/fr/docs/Web/API/ServiceWorker_API)
- [Utilisation de Service Workers](/fr/docs/Web/API/ServiceWorker_API/Using_Service_Workers)