aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/storage/length/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/es/web/api/storage/length/index.html')
-rw-r--r--files/es/web/api/storage/length/index.html117
1 files changed, 117 insertions, 0 deletions
diff --git a/files/es/web/api/storage/length/index.html b/files/es/web/api/storage/length/index.html
new file mode 100644
index 0000000000..47434b2813
--- /dev/null
+++ b/files/es/web/api/storage/length/index.html
@@ -0,0 +1,117 @@
+---
+title: Storage.length
+slug: Web/API/Storage/length
+translation_of: Web/API/Storage/length
+---
+<p>{{APIRef("Web Storage API")}}</p>
+
+<p>La propiedad de sólo lectura <code>length</code> de la interfaz {{domxref("Storage")}} devuelve un entero que indica el numero de elementos guardados en el objeto<code> Storage</code>.</p>
+
+<h2 id="Sintaxis">Sintaxis</h2>
+
+<pre class="syntaxbox">var <em>aLength</em> = <em>storage</em>.length;</pre>
+
+<h3 id="Valor_devuelto">Valor devuelto</h3>
+
+<p>Entero</p>
+
+<h2 id="Ejemplo">Ejemplo</h2>
+
+<p>La siguiente función añade tres elementos de datos en el almacen local para el dominio actual, posteriormente, devuelve el número de elementos guardados en el almacen:</p>
+
+<pre class="brush: js">function populateStorage() {
+ localStorage.setItem('bgcolor', 'yellow');
+ localStorage.setItem('font', 'Helvetica');
+ localStorage.setItem('image', 'cats.png');
+
+ localStorage.length; // should return 3
+}</pre>
+
+<div class="note">
+<p><strong>Nota</strong>: Para un ejemplo real, vea nuestro <a href="https://github.com/mdn/web-storage-demo">Web Storage Demo</a>.</p>
+</div>
+
+<h2 id="Especificaciones">Especificaciones</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificacíon</th>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentario</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('Web Storage', '#dom-storage-length', 'length')}}</td>
+ <td>{{Spec2('Web Storage')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_en_navegadores">Compatibilidad en navegadores</h2>
+
+<p>{{ CompatibilityTable() }}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>localStorage</td>
+ <td>4</td>
+ <td>3.5</td>
+ <td>8</td>
+ <td>10.50</td>
+ <td>4</td>
+ </tr>
+ <tr>
+ <td>sessionStorage</td>
+ <td>5</td>
+ <td>2</td>
+ <td>8</td>
+ <td>10.50</td>
+ <td>4</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Característica</th>
+ <th>Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Soporte básico</td>
+ <td>2.1</td>
+ <td>{{ CompatUnknown }}</td>
+ <td>8</td>
+ <td>11</td>
+ <td>iOS 3.2</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>Los navegadores tienen diferentes niveles de capacidad, tanto para el localStorage como para el sesionStorage. He aquí una <a class="external" href="http://dev-test.nemikor.com/web-storage/support-test/" title="http://dev-test.nemikor.com/web-storage/support-test/">lista detallada de todas las capacidades de almacenamiento para varios navegadores</a>.</p>
+
+<div class="note">
+<p><strong>Nota:  </strong>desde la versión 5.1 de iOS, Safari Mobile almacena los datos de localStorage en la carpeta de la caché, la cual se vacía a intervalos, a criterio del sistema operativo, generalmente, si hay una falta de espacio.</p>
+</div>
+
+<h2 id="Vea_también">Vea también</h2>
+
+<p><a href="/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API">Uso de la Web Storage API</a></p>