localStorage何时清除? [英] When is localStorage cleared?

查看:362
本文介绍了localStorage何时清除?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以期待多久可以将数据保存在localStorage中。普通用户的localStorage数据会持续多久?如果用户没有清除它,它会持续到浏览器重新安装吗?



这是否跨浏览器一致?

只出于安全原因或用户要求时这样做。用户代理应始终避免删除数据,而脚本可以访问该数据。

直到用户在所有浏览器上删除它,我还没有发现任何已经删除了我的项目。



一篇好文章也是 http://ejohn.org/blog/dom-storage/


How long can I expect data to be kept in localStorage. How long will an average user's localStorage data persist? If the user doesn't clear it, will it last till a browser re-install?

Is this consistent across browsers?

解决方案

W3C draft says this

User agents should expire data from the local storage areas only for security reasons or when requested to do so by the user. User agents should always avoid deleting data while a script that could access that data is running.

So if browsers follow the spec it should persist untill the user removes it on all browsers, I have not found any that have deleted on any off my projects.

A good article to read is also http://ejohn.org/blog/dom-storage/

这篇关于localStorage何时清除?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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