Get Local Storage Item

Definition:

NDLLibrary.getLocalStorageItem(itemName)

 

Description:

Obtain the value stored in a named area of local HTML5 storage.

 

Parameters:

This function has one parameter:

itemName - Required

The name of the local HTML5 storage item whose contents you want to retrieve. The name is case-sensitive.

Note: This function does not use the default ndlParams object.

 

Returns:

A string containing the contents of the specified storage item.

Empty string if local HTML5 storage is not supported by user's browser or item not found.

 

Code Sample:

var itemName = "myStore";

return NDLLibrary.getLocalStorageItem(itemName);

 

Notes:

 

 

Using as Predefined Action in Event:

When assigned to an Event as a predefined action, you will need to generate a JavaScript function and then edit the skeleton script created to specify the name of your storage item. Edit the automatically generated code:

return NDLLibrary.getLocalStorageItem(ndlParams);

so it matches the two lines shown in the code sample section above, replacing myStore with the actual storage item's name, leaving the double quotes around it.

Alternatively you can enter the item's name directly in the original code, in place of ndlParams, e.g.:

return NDLLibrary.getLocalStorageItem("myStore");

Note that if you enter the name directly, it must be surrounded by double quotes.

 

 


See also:

Set Local Storage Item

Remove Local Storage Item