Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
Guardar datos HTML del lado del cliente

Si asigno una etiqueta de entrada de texto a la identificación de datos almacenados1 en el código a continuación, ¿podría guardar mis datos del lado del cliente (como guardarlos en una unidad flash)?

HTML

 Data that is retrieved will appear here <div id="dataStore"></div>

JS

 <script> if (typeof Storage !== 'undefined') { localStorage.setItem('stored_data1', 'Blue Box'); document.getElementById('dataStore').innerHTML = localStorage.getItem('stored_data1'); } else { // in case web storage is not supported document.getElementById('dataStore').innerHTML = 'Web storage not supported.'; } </script>

El código anterior es una API de almacenamiento web para HTML. Espero encontrar una manera de eventualmente encajarlo en algunos programas que hice.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Puedes descargar la información de la etiqueta usando el siguiente código

 //create a function to download text to textfile function downloadText(text, filename){ var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text)); element.setAttribute('download', filename); element.style.display = 'none'; document.body.appendChild(element); element.click(); } //get Text Value then download var textValue = document.getElementById("test").innerText; download(textValue, "store_data");
about 4 years ago · Juan Pablo Isaza Report

0

<!DOCTYPE html> <html> <head> <title>Page Title</title> </head> <body> <p>Data that is retrieved will appear here</p> <div id="dataStore"></div> </body> <script> if (typeof(Storage) !== "undefined") { window.localStorage.setItem("stored_data1", "Blue Box"); document.getElementById("dataStore").innerHTML = window.localStorage.getItem("stored_data1"); } else { document.getElementById("dataStore").innerHTML = "Web storage not supported."; } </script> </html>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!