<!doctype html>functionIssupportstorage () {return' Localstorage 'inchwindow; } alert (Issupportstorage ()); //determine if H5 local storage is supported</script><!--***************************localstorgae.getitem () ****************************-< Script>functionSet () {//setting up local storage varinput = Document.queryselector (' #input '); varValue =Input.value; Localstorage.setitem (' Name ', value); } functionGet () {//Get local Storage varValue = Localstorage.getitem (' name '); varinput = Document.queryselector (' #input '); Input.value=value; } </script> <input type= "text" id= "input"/><br/> <button onclick= "set ()" > Save </b utton> <button onclick= "Get ()" > Get </button><!--**************localstorage.key () * * * Localstorage.removeitem () ***************-<script>functionListalldata () {//get all local storage data varList =[]; for(vari=0; i<localstorage.length; i++){ varKey =Localstorage.key (i); varValue =Localstorage.getitem (key); List.push ({' K ': Key, ' V ': Value}); } returnlist; } functionShowData () {//Show all locally stored data vardata =Listalldata (); varhtml = ' '; for(vari=0; i<data.length; i++) {HTML+ = data[i].k + ' = ' + data[i].v + ' <button onclick=\ ' del ("' + DATA[I].K + '") \ ' > Delete </button><br/> '; } document.queryselector (' #div '). InnerHTML =html; } functiondel (key) {Localstorage.removeitem (key); ShowData (); } </script> ShowData (); </script><!--****************json.stringify () **json.parse () *******************************-< Script>varJsonobj = {' id ': 123, ' name ': ' BR '}; functionset () {Localstorage.setitem (' JSON ', Json.stringify (jsonobj)); } functionget () {varv = json.parse (Localstorage.getitem (' JSON '))); Console.log (v); } </script> <button onclick= "set ()" > Save </button> <button onclick= "Get ()" > Get </button& gt;<!--***************************sessionstorage***********************************-<script>functionSet () {//setting up local storage varinput = Document.queryselector (' #input '); varValue =Input.value; Sessionstorage.setitem (' Name ', value); } functionGet () {//Get local Storage varValue = Sessionstorage.getitem (' name '); varinput = Document.queryselector (' #input '); Input.value=value; } </script> <input type= "text" id= "input"/><br/> <button onclick= "set ()" > Save </b utton> <button onclick= "Get ()" > Get </button> </body>HTML5 Localstorage and Sessionstorage