blob: a038b1ea4a2d5ff6d55f8c7c8e633da214fd2de8 (
plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
---
title: 'Window: Evenement offline'
slug: Web/API/Window/offline_event
tags:
- API
- Event
- Offline
- Reference
- Window
translation_of: Web/API/Window/offline_event
---
<p>{{APIRef}}</p>
<p>L'événement <strong><code>offline</code></strong> de l'interface {{domxref("Window")}} se déclenche lorsque le navigateur perd la connexion au réseau et la valeur de {{domxref("Navigator.onLine")}} bascule à <code>false</code>.</p>
<table class="properties">
<tbody>
<tr>
<th scope="row">Bulles</th>
<td>Non</td>
</tr>
<tr>
<th scope="row">Annulable</th>
<td>Non</td>
</tr>
<tr>
<th scope="row">Interface</th>
<td>{{domxref("Event")}}</td>
</tr>
<tr>
<th scope="row">Propriété de gestionnaire d'événements</th>
<td>{{domxref("GlobalEventHandlers.onoffline", "onoffline")}}</td>
</tr>
</tbody>
</table>
<h2 id="Exemples">Exemples</h2>
<pre class="brush: js notranslate">//version addEventListener
window.addEventListener('offline', (event) => {
console.log("La Connexion au réseau est perdu.");
});
// onoffline version
window.onoffline = (event) => {
console.log("La Connexion au réseau a été perdue.");
};
</pre>
<h2 class="brush: js" id="Spécifications">Spécifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Spécification</th>
<th scope="col">Statut</th>
</tr>
<tr>
<td>{{SpecName('HTML WHATWG', "indices.html#event-offline", "offline event")}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
</tr>
</tbody>
</table>
<h2 id="Compatibilité_des_Navigateurs">Compatibilité des Navigateurs</h2>
<p>{{Compat("api.Window.offline_event")}}</p>
<h2 id="Voir_également">Voir également</h2>
<ul>
<li><a href="/en-US/docs/Web/API/Window/online_event"><code>online</code></a></li>
</ul>
|