HTML5 Web Storage

 HTML5 Web Storage


Web storage allows you to store data in the browser's storage for persistence between sessions. There are two types of web storage available: localStorage and sessionStorage. Here's an example of using localStorage:


<script>

  // Storing data in localStorage

  localStorage.setItem("username", "John");


  // Retrieving data from localStorage

  const username = localStorage.getItem("username");

  console.log(username); // Output: John


  // Removing data from localStorage

  localStorage.removeItem("username");

</script>

No comments:

Post a Comment

The Importance of Cybersecurity in the Digital Age

 The Importance of Cybersecurity in the Digital Age Introduction: In today's digital age, where technology is deeply intertwined with ev...