HTML5 Store Data Locally



Its possible to Store data Locally in HTML5, the stored data is accessible by the application which made the data. It is much simple to store data in HTML5, I tried this on my google chrome(20.0.1132.57 m) and it took hardly 5 minutes to save my first data. hereis the steps

First Create your HTML Code

here is my sample code



<title>New Page 1</title>


function localSaveandDisplay()
localStorage.var1=localStorage.var1 + ‘\n’ + document.form1.text1.value;


<body onload=”localSaveandDisplay();”>

<form method=”POST” action=”–WEBBOT-SELF–” name=”form1″>
<textarea rows=”5″ name=”text1″ cols=”20″ onselect=”localSaveandDisplay();”></textarea></p>
<p><textarea rows=”6″ name=”text2″ cols=”20″></textarea></p>



Here What i did is created tqo text boxes

text1 to type and save to local data

text2 to display saved data

and i called the main function to save and display on text selection (onselection) of text1 – Green Line

Now the main part, the line

localStorage.var1=localStorage.var1 + ‘\n’ + document.form1.text1.value;

saves data in to local machine with a newline character in between. this will save the text in text1 locally and up on body load and saving it is fetched for display in text2


abhilash, is a programmer by profession and a technology addict with a passion towards browsing , shopping and imaging . My views may be biased on reviews. all images and videos are copyrighted to respective owners.

Add comment

Your Header Sidebar area is currently empty. Hurry up and add some widgets.