cookie、sessionStorage 和 localStorage 有什么区别?
Describe the difference between a cookie, sessionStorage and localStorage.
题目类型: 技术面试题
这是一道技术面试题,常见于澳洲IT公司面试中。
难度: hard
参考答案摘要
三者都是客户端的键值存储机制。(Storage API 以字符串存储,复杂对象需序列化。) cookie localStorage sessionStorage 发起方 客户端或服务端(Set-Cookie) 客户端 客户端 过期 通过 expires/max-age 配置 理论上永久(直到被清理) 关闭标签页/会话即清理 是否随请求自动发送到服务端 是(Cookie 头) 否 否 容量(每个 o...
本题提供 STAR 原则详细解答和技术解析,登录匠人学院学习中心即可查看完整答案。