The difference between a cookie and webstorage

A: storage space different from
1, web storage provides storage of 5M (different browsers), to provide space Cookie 4k of
2, web storage for each domain (including sub domains) have separate storage spaces, each memory space is completely independent, it will not cause data obfuscation
II: server interacts with the
1, web storage data in local storage only, and will not happen any server interaction
2, cookie content will be sent to the server together with the request ( every request for a new page, cookie will be sent in the past, potentially resulting in a waste of bandwidth)
III: Interface API
1, Web Storage provides many rich-to-use interface, with setItem, removeItemgetItem, clear, key and other methods, operational data simpler
2, cookie needs its own package setCookie, getCookie etc.

Guess you like

Origin www.cnblogs.com/Ky-Thompson23/p/12375020.html