localStorage
There has been a lot of buzz going around about HTML5 and its capabilities. We will cover one of them briefly.
Prior to HTML5 localStorage
, the only option that client-side JavaScript had for storing persistent data across pages was utilizing cookies. Cookies are limited in size and do not remain only on the client side; they are sent to the server with each request. HTML5 localStorage
considerably increases the storage limit and is strictly stored on the client side.
Some of the main reasons for utilizing localStorage
are caching Ajax-served data, common form fields across pages, autocomplete results, or working offline. However, it is fairly new and implementation still varies slightly between browsers.
HTML5 localStorage
allows the client side to store persistent data in key-value pairs across multiple browser windows restricted by the same-origin policy. The usage is simple. Here are the methods and properties we will be using to create the storage for our application:
localStorage...