Cookie note _ javascript skills

Source: Internet
Author: User
Cookies are often used, that is, key information is recorded. If you confirm that the information is not retained, you can set it to expire. 1. When Session. Clear () is found during the development process, the Session can be directly identified. Can the Cookie be used?
Cookie. Clear () tried one. If no result exists, the cookie still exists. The answer is no.

Session exists on the server and can be controlled by common programs. However, the Cookie is stored on an independent computer and cannot be directly removed (physically deleted ). However, you can delete the cookie in the browser. When the browser detects that the cookie expiration time is out of the range, the cookie information will not be loaded. Indicates that the cookie information is deleted.

2. In actual development, it is easy to remember the password, that is, to set a longer expiration time. No matter what the user does, watch this small problem for a long time.

However, after a time is set, can the program read the expiration time?

I tried it. {0001-1-1 0:00:00} is the content returned by the cookie expiration time. On January 1, January 1, the total time is 0. I found some information on the Internet,

When the browser sends Cookie information to the server, the validity period is not included.

When the browser sends Cookie information to the server, the validity period is not included. (The Cookie's Expires attribute always returns a datetime value of 0 .)


Now I understand the reason.
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.