[Summary version] A picture shows you the difference between local storage Cookie, LocalStorage and SessionStorage

The above is a mind map drawn by myself, welcome to correct me, Thanks♪(・ω・)ノThe

specific text version is as follows:
1. The storage size is different:
 cookie: 4K
session: 5M
local: 5M
2. The data validity period is different:
cookie can Settings, set the expiration time, or manually clear
the session: valid until the browser is closed
local: permanently valid
3, scope:
cookie is shared in all windows of the same origin
session is only shared in one browser, different browsers do not share
local in all the same Source window sharing
4. Communication:
Cookie: Passed by the browser and the server through http, generally carried in the header of the http request. For example, some key key verification, etc., so the session is not safe
only in the client
local only in the client
5. Application:
cookie to judge whether the user has logged in, remember the password to log in automatically, but it is not safe, the storage space is small, and the operation is troublesome .
Login with session sensitive account once, close the browser and delete
local personal long-term login, save data for a long time

Guess you like

Origin blog.csdn.net/m0_71981318/article/details/125372319