forked from wojodesign/local-storage-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
37 lines (27 loc) · 1.16 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**********************************************************/
Cross Browser HTML5 Local Storage Support
/**********************************************************/
Brett Wejrowski
Wojo Design
wojodesign.com
brett@wejrowski.com
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