[转]笔记:客户端数据存储
Cookie
4K
Cookie里的每个数据不管是否需要都会在每个http请求中被发往服务器,包括每个页面、图片、css、脚本或者ajax的请求,无形中占用了多余的带宽。
写入的cookie超过限制,就会造成原来有用的cookie丢失。
HTTP cookies (need tor)
DOM Storage
5120K
DOM Storage is a way to store meaningful amounts of client-side data in a persistent and secture manner.
DOM Storage 是一种的可以持久而安全地存储大量有效客户端数据的方法.
sessionStorage, globalStorage[location.host], globalStorage[’org’], globalStorage[”]. 后两个出于安全的考虑,在Firefox2上并未实现。
sessionStorage的用法举例:
1. Data is persistent across page refreshes. 数据在页面刷新时不会丢失。
2. Data is persistent across browser crashes. (有bug)
http://ejohn.org/blog/dom-storage/
http://ejohn.org/blog/dom-storage-answers/
UserData
128KB\ / 1024K
Internet Explorer userData behavior
Therefore, it is recommended that you not persist sensitive data live credit card numbers.
Across sessions.
This provides a data structure that is more dynamic and has a greater capaticy than cookies.
Security Zone(Internet) / Document Limit(128KB) / Domain Limit(1024KB)
Setting the userData behavior class on the html, head, title, or style object causes an error when the save or load method is called.
默认保存在C:\Documents and Settings\Administrator\UserData\目录,保存格式为xml。
Attributes/Properties: expires, XMLDocument
Methods: getAttribute(), load, removeAttribute(), save(), setAttribute()
终于盼到了,firefox支持sessionStorage了
Flash Local Storage
100K unless you agree to allocate additional space
Flash文件的宽高至少为215*138
待续……
Addvantage
- 减少服务器负担
- 加速页面显示
Usage
- 用户首选项或跟踪数据,如用户阅读了新闻网站上的哪些文章。
- Flash:VideoPlayer保存一些用户设置(音量、播放模式、最新视频等)。


出处:http://QLeelulu.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· [AI/GPT/综述] AI Agent的设计模式综述