Storing Data the Simple HTML5 Way

Storing Data the Simple HTML5 Way

Get Storing

The API for localStorage and sessionStorage is exactly the same, and distills down to the following methods:

  • .setItem(key, value);
  • .getItem(key)
  • .removeItem(key)
  • .clear()
  • .key(index)
  • .length

http://php-html.net/tutorials/html5-local-storage-guide/

localStorage.name ='Remy';


localStorage.doctors = JSON.stringify(doctors);

var html5docs = JSON.parse(localStorage.doctors);
alert('There be ' + html5docs.length + ' doctors in the house');
 
 
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s