What is Local Storage in Web Application?

Question 1: What Is Windows.LocalStorage?

Answer:
 The Local storage mechanism spans multiple windows and persists beyond the current session. The Local Storage attribute provides persistent   storage areas for domains. It allows Web applications to store nearly 10 MB of user data. Web Application Can Store Data Locally in user' browsers. local storage same as cookies,session in web application.
Local Storage Without affecting web application performance. Local Storage is more secure. It can store large amount of data.(10MB). Local Storage can store one page can access web application All pages. Each And Every domain its own local storage variable.
  1. To Set Local Store in web application than you can use below syntax,

    Syntax: Windows.localStorage.setItem(Variable,value);

  2. To get Local Storage  value,

    Syntax: Windows.localStorage.getItem(Variable,);

  3. To Remove Value in Local Storage Variable,

    Syntax: Windows.localStorage.removeItem(Variable,);
Example:
  1. <html>  
  2. <script type="text/javascipt">  
  3.     windows.onload = setValue; function setValue(){ windows.localStorage.setItem("UserName","Kamal Bhagat") } function onClick(){ document.getElementById("txtUserName").text = windows.localStorage.getItem("UserName") }  
  4. </script>  
  5.   
  6. <body>  
  7.     Username:  
  8.     <input type="text" id="txtUserName">  
  9.     <br>  
  10.     <input type="submit" value="click" onclick="setValue();">  
  11. </body>  
  12.   
  13. </html>  
More Information About Below Link You can See:
Ebook Download
View all
Learn
View all