HTML5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

HTML5

The complete way to do local storage => in 2 types? with examples!

18th Jun 2018, 5:49 PM
Khentit Nadji Sabri
2 Answers
+ 2
<div id="res"></div> <script> // Check browser support if (typeof(Storage) !== "undefined") { // Store localStorage.setItem("name", "test"); // Retrieve document.getElementById("res").innerHTML = localStorage.getItem("name"); } else { document.getElementById("res").innerHTML = "Sorry, your browser does not support Web Storage..."; } </script> <!--Try on web version, sololearn codeplayground dose not support this-->
18th Jun 2018, 6:04 PM
Sudarshan Rai
Sudarshan Rai - avatar
+ 1
thanks
18th Jun 2018, 6:38 PM
Khentit Nadji Sabri