HTML5 provides a Localstorage object that can save data for long periods of time on the client until the person is cleared.
Localstorage provides several methods: 1, Storage: Localstorage.setitem (key,value) If key is present, update value 2, get: Localstorage.getitem (Key) If key does not exist return null 3, delete: Localstorage.removeitem (key) once deleted, key corresponding data will be deleted all 4, clear all: Localstorage.clear () Sometimes it is too cumbersome to use RemoveItem to delete each other, you can use clear, the result of the execution is to clear all the Localstorage object saved data 5, traverse localstorage stored key.length data total, Example: LocalStorage.length.key (index) Gets key, example: Var key=localstorage.key (index); 6. Store JSON format data json.stringify to convert an object into a JSON-formatted data string, returning the converted string Json.parse (data) to parse the data into objects, returning the parsed object
HTML5---localstorage