关于Html5的数据储存:cookie、sessionStorage、localStorage

1.cookie数据始终在浏览器和服务器间来回传递。而sessionStorage、localStorage不会把数据发送给服务端,仅在本地保存

2.cookie的数据可以限制在某一个路径下面。

3.cookie的数据大小一般只有4Kb,而sessionStorage、localStorage大小一般在5M左右或者更大

4.保存有效期不同:cookie只在设置过期时间前一直有效

sessionStorage数据仅在窗口关闭前有效

localStorage始终有效除非手动清除浏览器缓存

5.作用域不同:cookei与localStorage在所有同源窗口都是共享的而sessionStorage不能再不同的窗口共享

订阅评论
提醒
3 评论
最新
最旧 最多投票
内联反馈
查看所有评论

I am sure this post has touched all the internet users, its really really
fastidious article on building up new blog.

This pοst will help the internet visitors for building ᥙρ new blоg or even a weblog from start to end.

3
0
希望看到您的想法,请您发表评论x