Package | webstorage |
Interface | public interface Storage |
Introduced in: | HTML 5 |
sessionStorage
sets fields on the window. When the window is closed, the session fields
are lost, even if the site remains open in another window.
localStorage
sets fields on the domain. Even when you close the browser, reopen it, and
go back to the site, it remembers all fields in localStorage.
See also
Property | Defined By | ||
---|---|---|---|
Web Storage length : Number [read-only]
Returns the number of key/value pairs currently present in the list associated with the object. | Storage | ||
Non-Standard remainingSpace : Number [read-only]
Retrieves the remaining memory space, in bytes, for the storage object. | Storage |
Method | Defined By | ||
---|---|---|---|
Web Storage clear():void
Empties the object of all key/value pairs, if there are any. | Storage | ||
NameGetter
The getItem(key) method must return the current value associated with the given key. | Storage | ||
IndexGetter
Returns the value at the specified index. | Storage | ||
NameDeleter
The removeItem(key) method must cause the key/value pair with the given
key to be removed from the list associated with the object, if it exists. | Storage | ||
NameSetter
Adds the data based on the key name. | Storage |
Web Storage length | property |
length:Number
[read-only] Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Introduced in: | HTML 5 |
Returns the number of key/value pairs currently present in the list associated with the object.
public function get length():Number
See also
remainingSpace | property |
remainingSpace:Number
[read-only] Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Non-standard (Microsoft)
Retrieves the remaining memory space, in bytes, for the storage object.
The current size of the storage area is calculated as the sum of the length of all key names and values.
public function get remainingSpace():Number
See also
Web Storage clear | () | method |
public function clear():void
Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Introduced in: | HTML 5 |
Empties the object of all key/value pairs, if there are any.
See also
<button onclick="localStorage.clear()">Clear Stored Values</button>
Web Storage getItem | () | method |
public function getItem(key:DOMString):DOMString
Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Introduced in: | HTML 5 |
NameGetter The getItem(key) method must return the current value associated with the given key.
Parameters
key:DOMString |
DOMString |
See also
Web Storage key | () | method |
public function key(index:Number):DOMString
Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Introduced in: | HTML 5 |
IndexGetter Returns the value at the specified index.
Parameters
index:Number |
DOMString |
DOMException — INDEX_SIZE_ERR: May be raised if index is greater than or
equal to the number of key/value pairs in the object.
|
See also
Web Storage removeItem | () | method |
public function removeItem(key:DOMString):void
Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Introduced in: | HTML 5 |
NameDeleter The removeItem(key) method must cause the key/value pair with the given key to be removed from the list associated with the object, if it exists.
Parameters
key:DOMString — The name of the key, or the empty string.
|
See also
Web Storage setItem | () | method |
public function setItem(key:DOMString, data:DOMString):void
Product Versions : | 5.5 6.0 7.0 8.0 as IE7 8.0 as IE8 2.0 3.0 3.5b4 3.0 3.1 4.0 1.0 2.0 9.62 10.0b |
Introduced in: | HTML 5 |
NameSetter Adds the data based on the key name. If the key already exists, that data is updated with the new data.
Parameters
key:DOMString | |
data:DOMString |
DOMException — QUOTA_EXCEEDED_ERR: May be raised if setting fails.
|
See also
sessionStorage.setItem('myKey', '...'); sessionStorage['myKey'] = '...'; sessionStorage.myKey = '...';