HTML5本地存储中的项何时到期? [英] When do items in HTML5 local storage expire?

查看:83
本文介绍了HTML5本地存储中的项何时到期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数据存储在localStorage(作为HTML5中的DOM存储的一部分)可用的时间有多长?我可以为我放入localStorage的数据设置过期时间吗?根据John Resig的说法,不可能指定过期。这完全取决于用户。



http: //ejohn.org/blog/dom-storage/



编辑—显然,如果它自己的应用程序太旧,可以主动删除它们。也就是说,您可以在保存的内容中明确包含某种时间戳,然后稍后使用它来决定是否刷新信息。


For how long is data stored in localStorage (as part of DOM Storage in HTML5) available? Can I set an expiration time for the data which I put into localStorage?

解决方案

According to John Resig, it's not possible to specify expiration. It's completely up to the user.

http://ejohn.org/blog/dom-storage/

edit — obviously, your own application can actively remove stuff if it decides it's too old. That is, you can explicitly include some sort of timestamp in what you've got saved, and then use that later to decide whether or not information should be flushed.

这篇关于HTML5本地存储中的项何时到期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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