1.

What is the SessionStorage object in Html5? How to Create and Access?

Answer»

sessionStorage is a Web STORAGE to store the data. It retains data for a single session only. If the user closes the browser window, RECORDS stored are automatically cleared. This is an important advantage because only a limited amount of space is available.

SessionStorage is firmly dedicated to their respective browsing contexts. sessionStorage has a CONTEXT that, by design, is extremely CONFINED. It’s limited to a single browser tab or window. Its data cannot be passed from one tab to the next. However, the data can be shared among any <iframe> elements that exist on the page.

Code to show the usage of sessionStorage

window.onload = function() {      var currDate = new Date();      sessionStorage.setItem("currenttime", currDate.toLocaleString()); } function updateHTML() { document.getElementById("currenttime").innerHTML= sessionStorage.getItem("currenttime"); }


Discussion

No Comment Found