When storing data on the client, we generally use cookies (insensitive data). However, as clients become increasingly rich, the amount that cookies can store (maximum 4k per domain) is really small.
There is localStorage available in HTML5, but this abandons IE8-. For compatibility, we can dig out a storage method developed by IE a long time ago:
Add a special style url (#default#userData) to an element, and then you can access the key-value pair form through setAttribute and getAttribute. of data.
One thing to note is that you need to use the save method after the data is changed, and you need to load the data in the initial stage.
Next, I will post the usage method. When the browser used supports HTML5, use localStorage.