HTML5 Local Storage Tutorial with Example

By Prem Tiwari in Freebies, HTML & CSS, JavaScript, Web Technologies. Updated on


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

local-storage

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.

html5-browser-support

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.

Read:

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

Conclusion

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!

Sharing is caring!


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

You might also like:

Tags: , , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.