Functions same as the LocalStorage of HTML5, and supported by lower IE versions. (For more information, see http://www.w3.org/TR/webstorage/#storage.)
The LocalStorage can save data in the area provided by the browser. The size of the data that can be stored depends on the browser settings.
Similar to the cookie. However, there is no expiration and a larger amount of data can be stored. In most cases, 5MB~10MB data can be stored depending on the browser. It is recommended to save not more than 5MB to support multi-browsing.
The LocalStorage can save data in the area provided by the browser. The size of the data that can be stored depends on the browser settings.
Similar to the cookie. However, there is no expiration and a larger amount of data can be stored. In most cases, 5MB~10MB data can be stored depending on the browser. It is recommended to save not more than 5MB to support multi-browsing.
Type
- engine
Property Summary
Event Summary
Method Summary
- clear( )
- Deletes the data saved in the localStorage for the same domain.
- getAllItem( )
- Returns all data saved in the localStorage for the same data as a key/value object.
- getItem( keyName )
- Returns the keyName from the LocalStorage.
- key( index )
- Gets the key of the corresponding index.
- length( )
- Number of (key, value) pair data in the localStorage.
- removeItem( key )
- Removes the data (item) of the corresponding keyName.
- setItem( keyName , value )
- Saves the key/value data in the localStorage.
Property Detail
Event Detail
Method Detail
- clear( )
-
Deletes the data saved in the localStorage for the same domain.Sample
$w.local.clear(); - getAllItem( )
-
Returns all data saved in the localStorage for the same domain as a (key, value) pair object.
Return type description JSON JSON object containing key/value data Samplevar tmpData = $w.local.getAllItem(); // (Return Example) { name:"WebSquare" , add:"Seoul" } - getItem( keyName )
-
Returns the value of the specified keyName from the LocalStorage.
Parameter name type required description keyName String Y Saved key vavlue. Return type description String If there is any data matching with the keyName, the value will be returned. Otherwise, null will be returned. Sample// "WebSquare" is saved with the key of name. $w.local.getItem("name"); (Return Example) "WebSquare" - key( index )
-
Gets the key of the specified index. The index of the saved key depends on the browser. In other words, the index may differ in each browser.
Parameter name type required description index Number Y Index of the saved key. Return type description String Returns the key of the specified index. Otherwise, null will be returned. Sample// In Chrome, the index of the last saved value is 0, while in IE, the index of the first save value is 0. (Compared to November 2014. ) $w.local.key(0); (Return Example) "name" - length( )
-
Number of the (key, value) pair data in the local storage.
Return type description Number Number of (key/value) data saved in the localStorage. Sample$w.local.length (Return Example) 2 - removeItem( key )
-
Removes the data (item) of the corresponding keyName.
Call clear() to delete all data.Parameter name type required description key String Y Key of the data (item) to delete Sample$w.local.removeItem("name"); // Delete the name item. - setItem( keyName , value )
-
Saves key/value data in the localStorage.
Parameter name type required description keyName String Y Key to save value String Y Value to save Sample// Save Websquare value with name key. $w.local.setItem("name", "WebSquare");