HTML Session Storage
You are Here:
HTML Session Storage
The HTML Session Storage allows you to access and save data (key/value pairs) in a web browser.
Note: The properties of Session Storage as follows:
- Unlike Local Storage, the data stored in Session Storage is cleared when the page session ends.
- Closing a tab/window ends the session and clears objects in Session Storage.
- The keys and values are always strings.
How to view Session Storage?
Follow the below steps to view your data stored in the Session 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 Session 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");
function UserVisit(){
if(typeof(Storage) !== "undefined"){
if(sessionStorage.visitCount)
sessionStorage.visitCount = Number(sessionStorage.visitCount) + 1;
else
sessionStorage.visitCount = 1;
x.innerHTML = "You have visited this page " + sessionStorage.visitCount + " time(s) in this Session.";
}
else{
x.innerHTML = "Sorry, your browser does not support web storage...";
}
}
UserVisit();
</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.