HTML5 Local Storage Tutorial with Example

In this article we will learn how easy to store information locally on user’s computer by using HTML5 Local Storage. It is a very powerful strategy and very useful for a web developer. Local storage store and access data per domain & per protocol for all pages of your application.

By using HTML5 local storage you can store your web page’s CSS, Javascript files and images locally ot reduced server usage


Why Use HTML5 Local Storage

Your web application was used cookies to stored data in your local machine before, but now days you can store larger amounts of data in locally in the browser by using HTML5 local storage features and this is more secure compare of cookies.

Web Browser Support

Most popular browsers supports HTML5 local storage.


Storing and Retrieving Local storage Values

There are many ways to store and retrive HTML5 local storage value. Below is the one of them :

In the above code setItem() method used to save data in current local storage and localStorage.getItem method used to retrieve your local storage data.


Hotel Search using Google Maps JavaScript API v3
Facebook style confirm alert box
Text box validation alert message using jquery


If you are building your application which extensively interact with larger data, then i recommend to use HTML5 local storage. If you like this article, subscribe our newsletter and share it with your friends!

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Article Tags: , , , ,