Use localStorage.getLength(), not localStorage.length
|
To get the length of GDSecureStorage , do not use localStorage.length . Use the following method instead: localStorage.getLength() .
This method returns the size of "localStorage" ( GDSecureStorage ).
|
localStorage operations secured by the SDK
|
If you use localStorage.setItem(key, value) to write values to localStorage , it is stored in GDSecureStorage and is protected. If you use localStorage.getItem(key) to read values from localStorage , it is read from GDSecureStorage . If you use localStorage.removeItem(key) to remove some value from localStorage , it is removed from GDSecureStorage . If you use localStorage.key(index) to get the key by index from localStorage , the key is retrieved from GDSecureStorage . If you use localStorage.clear() to clear localStorage , GDSecureStorage is cleared.
|
localStorage operations not secured by the SDK
|
If you write values to localStorage with localStorage[key] = value the value is not stored in GDSecureStorage and is not protected. It is stored in the native Storage object. If you read a value from localStorage with var value = localStorage[key] the value is not retrieved from GDSecureStorage but from the native Storage object. If you use localStorage.length to get the size of localStorage , this returns the length of native Storage object, not the length of GDSecureStorage . Use localStorage.getLength() instead.
|