Web Storage
来源:互联网 发布:数据恢复教程 编辑:程序博客网 时间:2024/04/23 16:54
cookie的缺点:
- Cookie 的大小被限制为 4KB;
- Cookie 会包含在每个HTTP请求中向服务器发送,这样势必导致多次发送重复数据;
- Cookie 在网络传输时并未加密(除非整个应用都使用SSL),因此可能存在一些安全隐患。
HTML5的Web Storage:
HTML5 新增了Web Storage功能。通过Web Storage,可以让应用程序在客户端运行时在客户端保存程序数据。相关方法如下:
- length :该属性返回Storage里保存了多少组键值对;
- key(index):该方法返回该Storage中第index个key值;
- getItem(key):该方法返回该Storage中指定key对应的value;
- setItem(key,value):该方法用于向该Storage存入指定的 key-value 对;
- removeItem():该方法用于从该Storage删除指定key对应的 key-value 对;
- clear( );该方法用于删除该Storage中所有的 key-value 的对。
web storage 分为:localStorage和sessionStorage两种;localStorage长期保存本地,除非用户自己删除;sessionStorage存储时间为会话期间,关闭浏览器就删除了。
0 0
- Web Storage
- WEB Storage
- Web Storage
- Web Storage
- Web Storage
- Web Storage
- Web Storage
- Web Storage
- Web Storage
- web storage
- Web Storage
- web storage
- Web Storage
- Web Storage
- Web Storage
- web storage
- Web Storage
- Web Storage
- OS X View Controllers Tutorial学习笔记
- 【腾讯WeTest干货分享】高并发性能调试经验分享
- Python Tricks(十七)—— enumerate 的实现
- JVM垃圾回收器工作原理及使用实例介绍
- 连续分配方式 -- 动态分区分配
- Web Storage
- 关于JavaScript调试的十来个小技巧
- Android安全攻防战,反编译与混淆技术完全解析(上)
- android activity的四种启动模式
- 自己喜欢什么样的工作
- leetcode 193. Valid Phone Numbers
- DWR入门教程(java的ajax框架)
- 10分钟搞定支付宝和微信支付的各种填坑
- ImageView 设置图片的方法