Home > Web Front-end > JS Tutorial > A brief analysis of JavaScript operation cookie object_Basic knowledge

A brief analysis of JavaScript operation cookie object_Basic knowledge

WBOY
Release: 2016-05-16 16:24:31
Original
1151 people have browsed it

Cookie Object

is a kind of data information (Cookie data) saved in the Cookies folder of the client's hard disk in the form of a file (Cookie file). User data information in the cookie folder (Cookie data). The cookie file is created by the visited Web site to permanently save the session data between the client and the Web site, and the cookie data is only allowed to be read by the visited Web site. (Cross-domain access is not allowed)

Cookie file format:

NS:Cookie.txt
IE: username@domain name.txt

Javascript writes to Cookie

Format:
document.cookie="keyword=value[;expires=valid date][;…]"
Note:
Valid date format: Wdy,DD-Mon-YY HH:MM: SS
Wdy/Mon: English week/month;
Also contains path, domain, secure attributes;
Each website (domain) can create 20 cookie data;
Each browser can store 300 cookie data, 4K bytes;
The customer has disabled the writing of cookie data.

It is much more troublesome to use js to operate cookies than to use jsp servlet to operate cookies

Why can’t I see the cookie file used to store Session in the Cookie folder?

Use two types of cookies

Persistent cookies will be stored on the client's hard drive.
Session Cookie: It is not stored on the client's hard disk, but is placed in the memory of the browser process. When the browser is closed, the session Cookie is destroyed.

Copy code The code is as follows:









Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template