The nsIDOMStorage2
interface represents the storage space used for local storage in the DOM. Items stored in local storage may only be accessed by the same origin that created the items in the first place.
A DOM window's local storage object can be retrieved from the window's localStorage
attribute.
Inherits from: nsISupports
void clear(); |
DOMString getItem(in DOMString key); |
DOMString key(in unsigned long index); |
void removeItem(in DOMString key); |
void setItem(in DOMString key, in DOMString data); |
Attribute | Type | Description |
length | unsigned long | The number of keys stored in local storage. |
Clears the contents of this storage context; this removes all values bound to the domain or origin.
void clear();
None.
Returns from local storage the data corresponding to the specified key.
DOMString getItem( in DOMString key );
key
A string containing the data corresponding to the specified key, or null
if no data exists for the given key.
Returns the key for the item stored at the specified index in the data store.
DOMString key( in unsigned long index );
index
A string containing the requested key.
INDEX_SIZE_ERR
Given a key, removes the corresponding entry from local storage.
void removeItem( in DOMString key );
key
Sets the value corresponding to a given key. If the key does not already exist, a new key is added, associated with the specified value. If the key already exists, the existing value is replaced with the specified value.
void setItem( in DOMString key, in DOMString data );
key
data
key
. nsIDOMStorageItem