Note: JavaScript Save Cookie

zhaozj2021-02-16  82

Since cookies involve a hard disk writing disk and read information to the user, it involves a confidential issue. If you need a lot of cookies, you should read the Cooikies written by Marc Slayton and re-examine the cookies. These articles will tell you the essence and scope of the cookie and its internal limitations. The most important limitations are: not everyone's browser welcomes cookies. Even the user's browser welcomes cookies, but users may also reject cookies access (most people still welcome) each domain name only assigns 20 cookies, so save what they are saved. Cookies must not be greater than 4 KB, of course, 4,000 bytes of capacity is sufficient.

After understanding these limitations, we start learning how to set up a cookies to set a basic cookie. What you need to do is just generated a string in a cookie_name = value form, then set the Document.cookie property. Unique skills: There is no space, comma or semicolon in the cookie value. It is good to do not have to worry about these issues, because there is a series of functions to help you encode and decode the cookies attribute:

Escape () and UNESCAPE ().

Save your name as a cookie in the simple example below:

============================================================================================================================================================================================================= =====================================================================================================================================================