• Stars
    star
    164
  • Rank 229,979 (Top 5 %)
  • Language
    JavaScript
  • Created almost 15 years ago
  • Updated over 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross Browser HTML5 Local Storage Polyfill
/**********************************************************/
	Cross Browser HTML5 Local Storage Support
/**********************************************************/
Brett Wejrowski
Wojo Design
wojodesign.com
[email protected]


The script implements a replacement for HTML5's localStorage when it is not supported.  
It implements a nearly identical interface using userData for IE6-7 and globalStorage 
for FF2-3.  You can find the spec of the HTML5 storage at 
	http://www.w3.org/TR/2009/WD-webstorage-20091222/
	


localStorage.setItem( key , value );
// saves a new name/value pair if the key doesn't exist, otherwise
// updates the value

localStorage.getItem( key );
// returns the value associated with the given key, if it exists
// returns null if the key doesn't exist

localStorage.length;
// the number of unique keys stored 

localStorage.removeItem( key );
// deletes the name/value pair with the given key, if it exists
// if it does not exist, exits

localStorage.clear();
// delete all name/value pairs currently stored

localStorage.key( n );
// returns the name of the nth key in the list, will return null if n is
// greater than or equal to localStorage.length