Home  >  Article  >  Web Front-end  >  Cookie Notes_javascript skills

Cookie Notes_javascript skills

WBOY
WBOYOriginal
2016-05-16 18:30:51945browse

1. Once during the development process, I found Session.Clear(), which can directly clear the Session. Can Cookie be used?
I tried Cookie.Clear(), but to no avail, the cookie still exists. The answer is no.

Session is stored on the server side and can be controlled by common programs, but cookies are stored in a separate computer and cannot be directly removed (physically deleted). However, it can be deleted through the browser. When the browser detects that the cookie expiration time has exceeded the range, this cookie information will no longer be loaded. Indicates that the cookie information has been deleted.

2. In fact, during development, it is very simple to remember the password, which is to set the expiration time longer. Even that user would not be able to observe this small problem for a long time.

However, after setting the time, can the program read the expiration time?

I gave it a try. {0001-1-1 0:00:00} is the content returned by the cookie expiration time, January 1, 1 year, the time is always 0. I found some information on the Internet,

when browsing When the browser sends Cookie information to the server, it does not include the validity period information

When the browser sends Cookie information to the server, it does not include the validity period information. (The Expires property of a cookie always returns a datetime value of 0.)


Now I understand why.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn