The difference between Web storage and cookies

Source: Internet
Author: User

1) different storage space .

A) The WEB storage can provide 5MB of storage space (different browsers provide different space). Cookies are only 4KB.

b) Web storage each domain (including subdomains) has a separate storage space, each storage space is completely independent, so it does not cause data confusion.

2) interacting with the server .

The data in the WEB storage is only local and does not interact with the server.

The contents of the cookie are sent along with the request (bandwidth wasted).

3) interface .

Web storage provides more rich and easy to use interface, with Setitem,getitem,removeitem,clear and other methods, operation of data more convenient.

Cookies require the front-end developer to encapsulate Setcookie,getcookie.

4) cross-domain issues .

A cookie needs to specify a scope and cannot be called across domains.

Description: Cookies are also not available or missing: The role of cookies is to interact with the server as part of the HTTP specification, and the Web storage only for local "storage" data.

The above content for their own collation, if there are errors, please correct me, thank you ~ ~

The difference between Web storage and cookies

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.