aboutsummaryrefslogtreecommitdiff
path: root/files/es/web/api/storage/removeitem
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:41:45 -0500
commit1109132f09d75da9a28b649c7677bb6ce07c40c0 (patch)
tree0dd8b084480983cf9f9680e8aedb92782a921b13 /files/es/web/api/storage/removeitem
parent4b1a9203c547c019fc5398082ae19a3f3d4c3efe (diff)
downloadtranslated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.gz
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.tar.bz2
translated-content-1109132f09d75da9a28b649c7677bb6ce07c40c0.zip
initial commit
Diffstat (limited to 'files/es/web/api/storage/removeitem')
-rw-r--r--files/es/web/api/storage/removeitem/index.html142
1 files changed, 142 insertions, 0 deletions
diff --git a/files/es/web/api/storage/removeitem/index.html b/files/es/web/api/storage/removeitem/index.html
new file mode 100644
index 0000000000..f597bd4d5a
--- /dev/null
+++ b/files/es/web/api/storage/removeitem/index.html
@@ -0,0 +1,142 @@
+---
+title: Storage.removeItem()
+slug: Web/API/Storage/removeItem
+tags:
+ - API
+ - Almacenamiento
+ - Almacenamiento web
+ - Referencia
+ - Storage
+ - Web Storage
+ - metodo
+translation_of: Web/API/Storage/removeItem
+---
+<p>{{APIRef("Web Storage API")}}</p>
+
+<p>El método <code>removeItem()</code> de la interfaz {{domxref("Storage")}} elimina la clave cuyo nombre recibe por parámetro del almacenamiento. La interfaz <code>Storage</code> de la <a href="/es/docs/Web/API/API_de_almacenamiento_web">API de almacenamiento web</a> provee acceso al almacenamiento de la sesión (<code>sessionStorage</code>) o al almacenamiento local (<code>localStorage</code>).</p>
+
+<h2 id="Sintaxis">Sintaxis</h2>
+
+<pre class="syntaxbox notranslate"><em>storage</em>.removeItem(<em>keyName</em>);</pre>
+
+<h3 id="Parámetros">Parámetros</h3>
+
+<dl>
+ <dt><em><u>keyName</u></em></dt>
+ <dd>Una {{domxref("DOMString")}} que contiene el nombre de la clave que se desea eliminar.</dd>
+</dl>
+
+<h3 id="Devuelve">Devuelve</h3>
+
+<p><em>Ningún valor.</em></p>
+
+<h2 id="Ejemplos">Ejemplos</h2>
+
+<p>La siguiente función crea 3 elementos dentro del almacenamiento local y después elimina el elemento <code>image</code>.</p>
+
+<pre class="brush: js notranslate">function populateStorage() {
+ localStorage.setItem('bgcolor', 'red');
+ localStorage.setItem('font', 'Helvetica');
+ localStorage.setItem('image', 'myCat.png');
+
+ localStorage.removeItem('image');
+}</pre>
+
+<p>De la misma manera se podría manipular el almacenamiento de sesión:</p>
+
+<pre class="brush: js notranslate">function populateSessionStorage() {
+  sessionStorage.setItem('bgcolor', 'red');
+  sessionStorage.setItem('font', 'Helvetica');
+  sessionStorage.setItem('image', 'myCat.png');
+
+  sessionStorage.removeItem('image');
+}</pre>
+
+<div class="note">
+<p><strong>Nota</strong>: Para ver esto en un ejemplo real, vea nuestra <a href="https://github.com/mdn/web-storage-demo">Demo de Web Storage</a>.</p>
+</div>
+
+<h2 id="Especificaciones">Especificaciones</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Especificación</th>
+ <th scope="col">Estado</th>
+ <th scope="col">Comentarios</th>
+ </tr>
+ <tr>
+ <td>{{SpecName('HTML WHATWG', 'webstorage.html#dom-storage-removeitem', 'Storage.removeItem')}}</td>
+ <td>{{Spec2('Web Storage')}}</td>
+ <td></td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Compatibilidad_con_navegadores">Compatibilidad con 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>Basic support</td>
+ <td>2.1</td>
+ <td>{{ CompatUnknown }}</td>
+ <td>8</td>
+ <td>11</td>
+ <td>iOS 3.2</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<p>Todos los navegadores tienen diferentes niveles de capacidad tanto para localStorage como para sessionStorage. Aquí hay un <a href="http://dev-test.nemikor.com/web-storage/support-test/" title="http://dev-test.nemikor.com/web-storage/support-test/">resumen detallado de la capacidad de almacenamiento para diversos navegadores</a>.</p>
+
+<div class="note">
+<p><strong>Nota: </strong>desde iOS 5.1, Safari Mobile almacena los datos de localStorage en la carpeta de cache, que está sujeta a borrados ocasionales a petición del sistema operativo, típicamente cuando queda poco espacio.</p>
+</div>
+
+<h2 id="Vea_también">Vea también</h2>
+
+<p><a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API">Utilizando la API de Web Storage</a></p>