When it comes to Local Storage i recommend using an abstraction library for many of the features discussed here as well as better compatibility.
But sometimes i just love to use the best and easy approach, cos i think importing a library for something you may only use once or may end up not using up to 10% ability of the library.
What is HTML Local Storage?
With local storage, web applications can store data locally within the user’s browser. Before HTML5, application data had to be stored in cookies, included in every server request. Local storage is more secure, and large amounts of data can be stored locally, without affecting website performance. Unlike cookies, the storage limit is far larger (at least 5MB) and information is never transferred to the server.
Local storage is per origin (per domain and protocol). All pages, from one origin, can store and access the same data. more info in w3schools