I have a web app I'm developing and quite like the idea that if the user makes changes to the view of the UI (eg. Lists open or closed, certain viewing preferences) those changes remain after they close the browser and visit the web app at a later date.
Possible options I can think of:
Once stored I will retrieve these preferences when the user returns and set the UI as it was when they last left it.
Does anyone have any experience of this type of feature and can suggest the best method for UI state save and retrieval?
Usually to store user preferences, it is best to use localStorage. It does not have expiration so will be valid unless and until you clear it programatically or user clears it in browser manually .
Customized preferences are stored in cookies that reside in Web client browsers. Thus, your preferences can't be used if you access the server from a browser other than the one for which you set up cookies. The Web server uses language string resource modules to render Web pages in different languages.
Most major modern web sites are dynamic — they store data on the server using some kind of database (server-side storage), then run server-side code to retrieve needed data, insert it into static page templates, and serve the resulting HTML to the client to be displayed by the user's browser.
The 3 ways to store data in the browser are Cookies, Local Storage, and Session Storage. Depending on the needs any one of them is used to store data in the browser. In today's article, we will discuss an in-depth comparison between local storage, session storage, and cookies.
If it's so small you should probably store the UI settings json object in your own database.
That will leave users with less problems at their end, like cache clearance and local storage unsupported browsers.
It will also make it possible for users to use the UI settings across different computers or browsers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With