HTML5 Local Storage Tutorial with Example

| Last Updated: | In: Freebies, HTML / CSS, html5, Javascript & Ajax


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!

Tags: , , , , ,


About: Prem Tiwari

Prem Tiwari is founder of freewebmentor.com and Software developer from New Delhi (India). Follow Prem's development codes on facebook, and make sure you check out freewebmentor.com for the latest in web development related Tips with the complete code.


You may also like:

Follow us!

Get Free Access of 350+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Learn how to implement security guideline in your WordPress site...

DOWNLOAD

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...

SEARCH NOW