English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The localStorage and sessionStorage properties allow keys to be saved in a web browser/Value pairs. The sessionStorage object only stores data for one session. When the browser is closed, the data will be deleted. It works in the same way as local storage. Firstly, we must check if the browser supports session storage. Later, we must create and retrieve data.
sessionStorage.setItem();
<html> <body> <p> id = "storage"/p> <script> if (typeof(Storage) !== "undefined") { sessionStorage.setItem("product", "Tutorix"); document.getElementById("storage").innerHTML = sessionStorage.getItem("product"); } else { document.getElementById("storage").innerHTML = "Sorry, no Web Storage compatibility..."; } </script> </body> </html>
Tutorix