blob: 4bc3fb867e25d6c676d63e7278cc46c18c2372be (
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
---
title: pageshow
slug: Web/API/Window/pageshow_event
translation_of: Web/API/Window/pageshow_event
original_slug: Web/Events/pageshow
---
<p>L’évènement <code>pageshow</code> est émis lorsqu’une entrée dans un historique de session est atteinte (cela comprend les boutons précédent / suivant ainsi que l’affichage initial de la page après l’évènement <code>onload</code>).</p>
<h2 id="Informations_générales">Informations générales</h2>
<dl>
<dt style="float: left; text-align: right; width: 160px;">Spécification</dt>
<dd style="margin: 0 0 0 160px;"><a class="external" href="http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#event-pageshow" lang="en-US">HTML5</a></dd>
<dt style="float: left; text-align: right; width: 160px;">Interface</dt>
<dd style="margin: 0 0 0 160px;"><a href="/fr/docs/Web/API/PageTransitionEvent">PageTransitionEvent</a></dd>
<dt style="float: left; text-align: right; width: 160px;">Bouillonne</dt>
<dd style="margin: 0 0 0 160px;">Non</dd>
<dt style="float: left; text-align: right; width: 160px;">Annulable</dt>
<dd style="margin: 0 0 0 160px;">Non</dd>
<dt style="float: left; text-align: right; width: 160px;">Cible</dt>
<dd style="margin: 0 0 0 160px;">Document (dispatché sur Window)</dd>
<dt style="float: left; text-align: right; width: 160px;">Action par défaut</dt>
<dd style="margin: 0 0 0 160px;">Aucune</dd>
</dl>
<h2 id="Propriétés" style="">Propriétés</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Propriété</th>
<th scope="col">Type</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>target</code> {{readonlyInline}}</td>
<td>{{domxref("EventTarget")}}</td>
<td>La cible de l’évènement (la plus haute dans l’arbre DOM).</td>
</tr>
<tr>
<td><code>type</code> {{readonlyInline}}</td>
<td>{{domxref("DOMString")}}</td>
<td>Le type d’évènement.</td>
</tr>
<tr>
<td><code>bubbles</code> {{readonlyInline}}</td>
<td>{{jsxref("Boolean")}}</td>
<td>Si l’évènement bouillonne en temps normal ou non.</td>
</tr>
<tr>
<td><code>cancelable</code> {{readonlyInline}}</td>
<td>{{jsxref("Boolean")}}</td>
<td>Si l’évènement est annulable ou non.</td>
</tr>
<tr>
<td><code>persisted</code> {{readonlyInline}}</td>
<td>{{jsxref("boolean")}}</td>
<td>Si l’entrée est chargée depuis le cache ou non.</td>
</tr>
</tbody>
</table>
<h2 id="Exemples">Exemples</h2>
<p>L’exemple suivant va afficher dans la console des informations sur l’évènement <code>pageshow</code>, qui est émis à l’utilisation des boutons précédent / suivant, et pas uniquement après <code>onload</code> :</p>
<pre class="brush: js">window.addEventListener('pageshow', function(event) {
console.log('pageshow:');
console.log(event);
});</pre>
<p>Bien que ce ne soit pas la meilleure pratique, vous pouvez également ajouter l’évènement comme un attribut sur la balise <code><body></code>, de la même manière que <code>onload</code> :</p>
<pre class="brush: html"><body onload="myonload()" onpageshow="mypageshowcode()"></pre>
<h2 id="Specifications">Spécifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Spécification</th>
<th scope="col">Statut</th>
<th scope="col">Commentaire</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('HTML WHATWG', 'browsing-the-web.html#event-pageshow', 'pageshow')}}</td>
<td>{{Spec2('HTML WHATWG')}}</td>
<td>Spécification initiale.</td>
</tr>
<tr>
<td>{{SpecName('HTML5 W3C', 'browsers.html#event-pageshow', 'pageshow')}}</td>
<td>{{Spec2('HTML5 W3C')}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Compatibilité des navigateurs</h2>
<p>{{Compat("api.Window.pageshow_event")}}</p>
<h2 id="See_also">Voir aussi</h2>
<ul>
<li>{{domxref("Window.pagehide_event", "pagehide")}}</li>
</ul>
|