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

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 2008-03-29 23:46  Q.Lee.lulu  阅读(593)  评论(0编辑  收藏  举报