Horje

Learn localStorage Object

<script>
// Store
localStorage.setItem("lastname", "Smith");

// Retrieve
document.getElementById("result").innerHTML = localStorage.getItem("lastname");
</script>

Output should be:

Learn localStorage Object



Single Articles
Learn localStorage ObjectHTML Web Storage API
Example explained: localStorage ObjectHTML Web Storage API
The example above could also be written like this:HTML Web Storage API
The syntax for removing the 'lastname' localStorage item is as follows:HTML Web Storage API


Related Articles
What is HTML Web Storage API HTML Web Storage API
What is HTML Web Storage? HTML Web Storage API
What Browsers will Support HTML Web Storage API HTML Web Storage API
How to create HTML Web Storage Objects HTML Web Storage API
How to create HTML localStorage Object HTML Web Storage API
How to create HTML sessionStorage Object HTML Web Storage API

Category:
Web Tutorial
Sub Category:
HTML Web Storage API
Uploaded by:
Admin



Share on: