A cookie is a text file stored in the computer’s browser, which allows you to store and retrieve information on the client side. A web page instructs the browser to store information upon an initial visit, and when the user returns to the website the cookie is added to the HTTP header. Server side programs read this information to identify a user, and in some cases display customized content for that user.
A cookie contains the following data.
A name-value pair containing the actual data.
An expiry date after which it is no longer valid.
The domain and path of the serverto which it should be sent.
Note that according to the same origin policy, cookies can only be accessed by pages originating from the same site. For example, the domain, application layer protocol, and port number (for most browsers) must match.
Cookie Limitation Standard
Practical web browsers have limits on the number and size of cookies that they can store. According to the IETF cookie specification, web browsers should provide the following minimum requirements:
at least 300 cookies;
at least 4096 bytes per cookie;
at least 20 cookies per unique host or domain name.
The cookie specification recommends that applications use as few cookies as possible and as small a cookie as possible. Additionally, applications should be able to handle the loss of a cookie.