随笔 - 153  文章 - 1  评论 - 1722  阅读 - 215万

[转]笔记:客户端数据存储

Cookie

4K

Cookie里的每个数据不管是否需要都会在每个http请求中被发往服务器,包括每个页面、图片、css、脚本或者ajax的请求,无形中占用了多余的带宽。

写入的cookie超过限制,就会造成原来有用的cookie丢失。

HTTP cookies (need tor)

DOM: document.cookie

 

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/

DOM: Storage

 

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了

UserData管理器和IE一个相关的Bug

UserData使用总结  - lanyu

浏览器缓存专题

JavaScript分层的概念与本地存贮

 

Flash Local Storage

100K unless you agree to allocate additional space

Flash Local Storage Setting

Flash文件的宽高至少为215*138

待续……

 

Addvantage

  1. 减少服务器负担
  2. 加速页面显示

 

Usage

  1. 用户首选项或跟踪数据,如用户阅读了新闻网站上的哪些文章。
  2. Flash:VideoPlayer保存一些用户设置(音量、播放模式、最新视频等)。
posted on   Q.Lee.lulu  阅读(595)  评论(0编辑  收藏  举报
编辑推荐:
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
阅读排行:
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 分享 3 个 .NET 开源的文件压缩处理库,助力快速实现文件压缩解压功能!
· Ollama——大语言模型本地部署的极速利器
· [AI/GPT/综述] AI Agent的设计模式综述
< 2008年3月 >
24 25 26 27 28 29 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示