HTML5 Web Storage

Before HTML5, to store or save small piece of information or text you have used cookie which is small text file used by website to store different information like expiration date, activation date, user encrypted password etc.

HTML5 introduced web storage which lets you store information inside the web page instead of using cookies. This is more secure and faster mechanism without compromising website performance. Now it is possible to store large amounts of data (at least 5MB) without affecting the website's performance.

HTML5 introduced two new objects to store information on the client which are known as "Local Storage" and "Session Storage". The Local Storage is used to store information when you don't require any expiration and it is per domain whereas Session Storage is used to store information for one session.

Before using local storage, you need to check whether browser is supporting for localStorage and sessionStorage

Local Storage

In HTML5, Local Storage is intended to store the data inside a web page without expiration date. The stored data without expiration date will not be removed when the browser is closed and will be available the next day, week, or year.

To create a localStorage is quite simple. In HTML5 localStorage object can be used to store data in two different way, by using built in method setItem(name,value) which accept name/value parameter. Look at below syntax.

Syntax1

//To Store data
localStorage.setItem("name", "jimi");

The anothe way of using localStorage is to create dynamic property to localStorage object look at below syntax.

Syntax2

// To Store Data
localStorage.name = "Jimi";

Browser Support

Almost all latest browsers like Safari, Google Chrome, Mozilla Firefox, Opera and Internet Explorer support many HTML5 features and functionalities.

See Also

HTML5 Web Storage
HTML5 Audio Tag
HTML5 Video Tag
HTML5 Canvas
HTML5 SVG Tag


 
 
SHARE THIS IF YOU LIKE!
submit to reddit

SUBSCRIBE FOR LATEST UPDATES
HAVE WE CONNECTED ON FACEBOOK?
TOP TUTORIALSTOP CODE EXAMPLESTOP LIVE DEMOLINKSSTAY CONNECTED
HTML Tutorial
HTML5 Tutorial
Bootstrap3 Tutorial
Javascript Tutorial
TypeScript Tutorial
AngularJS Tutorial
CSharp Tutorial
PHP Tutorial
Developer Tools
Javascript
AngularJS
Google MAP API V3
ASP.NET
Javascript
AngularJS
Google MAP API V3
Contact Us
Advertise with Us
Privacy Policy
Disclaimer
Stay connected. We actually like you. If you want to get up to the minute updates, then connect with us on your fav below.
 
Twitter   Linkedin   Facebook   Google+    RSS   Pinterest
 
Protected by Copyscape Original Content Checker
 
 
Copyright ©2017 www.techstrikers.com Unauthorized reproduction/replication of any part of this site is prohibited.