The similarities and differences between Localstorage and sessionstorage in Cookie and HTML5

Source: Internet
Author: User
Tags sessionstorage
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

Related Article

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.