Javascript: The Definitive Guide

Previous Chapter 15 Next
 

15.4 Cookie Limitations

Cookies are intended for infrequent storage of small amounts of data. They are not intended as a general-purpose communication or mechanism; use them in moderation. Note that web browsers are not required to retain more than 300 cookies total, nor more than 20 cookies per web server (for the entire server, not just for your page or site on the server), nor to retain more than 4 kilobytes of data per cookie (both name and value count towards this 4 kilobyte limit). The most restrictive of these is the 20 cookies per server limit, and so it is not a good idea to use a separate cookie for each variable you want to save. Instead, you should try to store multiple state variables within a single named cookie.

Cookies in Internet Explorer 3.0

In Internet Explorer 3.0, the cookie property only works for Document objects that were retrieved using the HTTP protocol. Documents retrieved from the local file system or via other protocols such as FTP cannot have cookies associated with them. This limitation will be resolved in a future release of IE.


Previous Home Next
Storing Cookies Book Index Cookie Example