在 Web 应用程序中存储小型 UI 用户首选项的最佳方式? [英] Best way to store small UI user preferences in web app?

查看:22
本文介绍了在 Web 应用程序中存储小型 UI 用户首选项的最佳方式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在开发的网络应用程序,并且非常喜欢这样的想法:如果用户对 UI 的视图进行更改(例如,打开或关闭列表、某些查看首选项),这些更改在关闭浏览器后仍然存在,并且稍后访问网络应用.

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.

我能想到的可能选项:

  1. 在 cookie 中存储 UI 首选项 JSON 对象.
  2. 使用 HTML5 本地存储(没有这方面的经验)
  3. 存储在 mySQL 数据库中(不热衷于将这些琐碎的数据存储在数据库中)

一旦存储,我将在用户返回时检索这些首选项,并将用户界面设置为他们上次离开时​​的状态.

Once stored I will retrieve these preferences when the user returns and set the UI as it was when they last left it.

有没有人对这种类型的功能有任何经验,可以建议最好的 UI 状态保存和检索方法?

推荐答案

如果它很小,您可能应该将 UI 设置 json 对象存储在您自己的数据库中.

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.

它还能让用户在不同的计算机或浏览器上使用 UI 设置.

It will also make it possible for users to use the UI settings across different computers or browsers.

这篇关于在 Web 应用程序中存储小型 UI 用户首选项的最佳方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆