aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/api/window/innerwidth/index.html
blob: 00047c4566c52dac63d60086e01901292c05958f (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
---
title: window.innerWidth
slug: Web/API/Window/innerWidth
translation_of: Web/API/Window/innerWidth
---
<p>{{ ApiRef() }}</p>

<h2 id="R.C3.A9sum.C3.A9" name="R.C3.A9sum.C3.A9">Résumé</h2>

<p>Récupère la largeur du contenu visible de la fenêtre de navigation en incluant, s'il est visible, l'ascenseur vertical.<br>
 Permet également de fixer une largeur pour le domaine d'affichage de la fenêtre.</p>

<h2 id="Syntaxe" name="Syntaxe">Syntaxe</h2>

<pre>var largeur = window.innerWidth;
</pre>

<p>Voir aussi : <a href="/fr/docs/Web/API/Window/innerHeight">window.innerHeight</a>, <a href="/fr/docs/Web/API/Window/outerHeight">window.outerHeight</a> and <a href="/fr/docs/Web/API/Window/outerWidth">window.outerWidth</a>.</p>

<h2 id="Valeur_renvoy.C3.A9e" name="Valeur_renvoy.C3.A9e">Valeur renvoyée</h2>

<dl>
 <dt><code>innerWidth </code></dt>
 <dd>un entier (nombre de pixels);</dd>
</dl>

<h2 id="Notes">Notes</h2>

<p>La propriété <code>innerWidth</code> est supportée par tous les objet "window" comme par exemple une fenêtre, une frame, un frameset, ou une fenêtre secondaire.</p>

<h2 id="Example">Example</h2>

<pre>// Retourne la largeur de la fenêtre
var largeur = window.innerWidth;

// Retourn la largeur de la fenêtre à l'intérieur d'une "frameset"
var largeur = self.innerWidth;

// Retourne la largeur de la fenêtre du "frameset" parent
var largeurDeLaFrame = parent.innerWidth;

// Retourne la largeur de la fenêtre du "frameset" principal
var largeurDuFrameset = top.innerWidth;</pre>

<p>Pour changer la taille de la fenêtre, voir {{domxref("window.resizeBy")}} and {{domxref("window.resizeTo")}}.</p>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{CompatibilityTable}}</p>

<table>
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Edge</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>1</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoDesktop(1.0)}}<sup>[1]</sup></td>
   <td>9</td>
   <td>9</td>
   <td>3</td>
  </tr>
 </tbody>
</table>

<table>
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Edge</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>1</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatGeckoMobile(1.0)}}<sup>[1]</sup></td>
   <td>9</td>
   <td>9</td>
   <td>3</td>
  </tr>
 </tbody>
</table>

<p>[1] From Firefox 4 to 24, this property was buggy and could give a wrong value before page load on certain circumstances, see {{bug(641188)}}.</p>

<h2 id="Sp.C3.A9cification" name="Sp.C3.A9cification">Spécification</h2>

<p>DOM Level 0. <code>window.innerWidth</code> ne fait partie d'aucune spécification ou recommandation technique du W3C.</p>

<p> </p>

<p> </p>

<div class="noinclude"> </div>

<p>{{ languages( { "en": "en/DOM/window.innerWidth", "ja": "ja/DOM/window.innerWidth" } ) }}</p>