What are Cookies?
Cookies are bits of data that are sent back and forth between a client (usually a browser) and a server for each request and response.
Where Cookies are Stored?
Cookies are stored as a text file in your hard disk.
Some browsers like Chrome will store cookies from each domain in a separate file. Whereas, some browsers like firefox stores all cookies in a same file.
Purpose of Cookies
- To identify visitors: You can detect when a user has previously visited your site and customize what that user sees on subsequent visits.
- To save transaction state: When filling out a lengthy form it is recommended to store the user typed value in a cookie because when a power cut or reload occurs you can refill the user typed value from the cookie when the user revisits that particular page.
The limitations of cookies as follows
- Length: Each domain is allowed to store 20 cookies (minimum) to 50 cookies (maximum).
- Expiry: There is no official time limitation for cookie expiry. You can set it to expire in a second, hour, month, year, or even decades. It is to be noted that user can delete your cookies without any restriction.
- Size: Some browsers like chrome, firefox have no size limitation and other browsers like Internet Explorer, Opera, Safari allows 4,096 bytes to store. So you are recommended to limit the size of your individual cookie to 4kb.
Please do google search for:
Join Our Channel
This channel is primarily useful for Full Stack Web Developer.