The cookie size is limited, and every time you request a new page, the cookie is sent in the past, which virtually wastes bandwidth, and the cookie needs to be specified.
Domain and cannot be called across domains.
WEB Storage has setitem,getitem,removeitem,clear and other methods, the operation is not as simple as a cookie requires the front-end developer to encapsulate Setcookie,getcookie.
The role of cookies is to interact with the server as part of the HTTP specification and the Web storage only for local "storage" of data
Localstorage is 5M (can be permanently saved) cookie is 4k
The cookie deals with XSS, and Localstorage does not
Sessionstorage refers to a session that exists in the server interaction, and the session ends and disappears
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
The similarities and differences between Localstorage and sessionstorage in Cookie and HTML5