HTML Local Storage
HTML Local Storage
The HTML Local Storage allows you to access and save data (key/value pairs) in a web browser.
Note: The properties of Local Storage as follows:
- Unlike sessionStorage, the data stored in Local Storage has no expiration time, i.e., the data will NOT be deleted when the browser is closed, and will be available the next day, week, or year.
- The keys and values are always strings.
How to view Local Storage?
Follow the below steps to view your data stored in the Local Storage:
- Go to Developer Tools or Press F12 or Press Ctrl + Shift + i.
- Switch to Application Tab on the top navigation bar.
- On the left side menu you will find the Local Storage.
Note: If you couldn't find your recent changes in the Session Storage, close and reopen the developer tools to see the changes.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<div id="point"></div>
<script>
var x = document.getElementById("point");
if(typeof(Storage) !== "undefined") {
localStorage.setItem("website", "wikimass.com");
x.innerHTML = localStorage.getItem("website");
}
else{
x.innerHTML = "Sorry, your browser does not support Web Storage";
}
</script>
</body>
</html>
Reminder
Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in HTML.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.