网站如何“离线”运营?模式,具有本地数据存储?

发布于 2024-12-14 13:13:25 字数 184 浏览 2 评论 0原文

我正在开发一个需要离线存储数据的网站。即,如果网络出现故障,数据将存储在客户端的本地 PC 上,并在用户下次上线时发送到服务器。

为了检测网络状态,我使用了对服务器的 jQuery AJAX 调用(我愿意接受其他可能的方式)。这里的挑战是以安全的方式将数据存储在本地,以便用户不会有意或无意地删除数据。

我怎样才能做到这一点?

I am working on a website which requires offline storage of data. i.e. if the network is down the data is stored locally on the client's PC and it is sent to the server next time the user goes online.

For detecting the network status I have used jQuery AJAX calls to the server (I am open to other possible ways). The challenge here is to store the data locally in a secure way so that the data can't be deleted by the user intentionally or accidentally.

How can I achieve that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

烟燃烟灭 2024-12-21 13:13:25

尝试本地存储 API。 http://hacks.mozilla.org/2009/06/localstorage/ 已实施一些现代浏览器。

编辑:在大多数浏览器中,清除 cookie 会清除 localStorage。

Try the localStorage API. http://hacks.mozilla.org/2009/06/localstorage/ It's implemented a few modern browsers.

EDIT: In most browsers, clearing cookies clears localStorage.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文