1、Cookie 的特點
服務器通過 Set-Cookie 響應頭設置 Cookie
瀏覽器得到 Cookie 之后,每次請求都要帶上 Cookie
服務器讀取 Cookie 就知道登錄用戶的信息(email)
問題
cookie 存在的問題:用戶可以隨意篡改 Cookie。
2、Session 與 Cookie 的關系
(1) cookie
(2)session
(3)LocalStorage
(4)SessionStorage(會話存儲)
瀏覽器緩存詳解:expires,cache-control,last-modified,etag
(1)expire是之前前端緩存的方式,區別于cache-control是設置結束時間,但存在用戶本地時間錯亂。
(2)cache-control和expire的使用:
response.setHeader('Cache-Control','max-age=30000000')
response.setHeader('Expires','Sun, 04 Feb 2018 14:40:05 GM')