This topic describes how you can manage application data in key-value format, using the Web storage.
To manage application data, you can use the Web standard Web Storage API.
The Web storage can only store up to 5 MB of data for your application. If you need to store larger amounts, use the file system.
Use the following methods to manage the Web storage:
To store a key-value pair, use the setItem() method:
localStorage.setItem('sample', 'This is just sample text.');
If the key does not exist, it is created with the specified value. If the key already exists, its value is updated.
To retrieve a key value, use the getItem() method:
var value = localStorage.getItem('sample');
If the key does not exist, the method returns null.
To remove a key, use the removeItem() method:
If the key does not exist, this method does nothing.