HTML5 implements local storage-localStorage, sessionStorage, and sessionlocalstorage
In html5, two methods are provided to implement local storage on the client: localStorage and sessionStorage. We can directly call the connector Crip interface to implement data storage.Let's talk about the differences between the two:· LocalStorage is permanently valid after the browser is closed after it is saved on the client, and sessionStorage fails when the window is closed. · localStorage is shared among windows in the current domain, sessionStorage is only valid in this windowLocalStorage and sessionStorage usage:· SetLocalStorage ['name'] = 'X'; localStorage. name = 'X'; localStorage. setItem ['name', 'x'];· GetLocalStorage. getItem ['name'] localStorage. name· DeleteLocalStorage. removeItem ['name']Get length:LocalStorage. lengthlocalStorage. name. length sessionStorage is the same as localStorage.When we use localStorage to save data, the stored format is a string, and the obtained format is also a string, so remember to use JSON. parse to serialize the data before usingIt is easy to use web apps for offline caching and cross-page data interaction.If there is any error in the text, please correct it :)