Horje
How to create HTML sessionStorage Object | HTML Web Storage API Code
How to create HTML sessionStorage Object

The sessionStorage object is equal to the localStorage object, except that it stores the data for only one session. The data is deleted when the user closes the specific browser tab.


Learn HTML sessionStorage Object

The following example counts the number of times a user has clicked a button, in the current session:
index.html
Example: HTML
<script>
if (sessionStorage.clickcount) {
  sessionStorage.clickcount = Number(sessionStorage.clickcount) + 1;
} else {
  sessionStorage.clickcount = 1;
}
document.getElementById("result").innerHTML = "You have clicked the button " +
sessionStorage.clickcount + " time(s) in this session.";
</script>

Output should be:

Learn HTML sessionStorage Object
Reffered: https://www.w3schools.com/html/html5_webstorage.asp



Read Full::
HTML Web Storage API Code
Category:
HTML Code
Sub Category:
HTML Web Storage API Code
Uploaded:
1 month ago
Uploaded by:
Admin
Views:
1

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

Single Articles
Learn HTML sessionStorage Object

Share on: