cookie localStorage sessionStorage 三者区别 整理

存储大小:cookie 4K   storage 5M

有效期:cookie 拥有有效期 storage 永久存储

cookie 会发送到服务器端   存储在内存中 storage 只存储在浏览器端

路径:cookie 有路径限制 storage 只存储在域名下

API: cookie 没有特定的API storage有对应的API

localStorage: 本地永久存储 sessionStorage 浏览器关闭就消失

猜你喜欢

转载自blog.csdn.net/u013194063/article/details/105023820
今日推荐