Cookie Jar v1.2
[ Home | News | Download | Examples | About ]
A Javascript class for easy access to browser cookies. Transparently creates a "vitual cookie jar" for storing many "virtual cookies" (key-value pairs) in one actual cookie to avoid the browser's limit on cookies.



Here is a basic example:
<script language="javascript" src="cookiejar.js"></script>
<script language="javascript">
    var cookiejar = new cookiejar("jarname");  	// read cookie data from jar "jarname"
    cookiejar.setcookie("foo", "bar");		// sets cookie "foo" to value "bar"
    alert (cookiejar.getcookie("foo"));		// gets cookie value "foo" and displays it
    cookiejar.write();    			// save cookie data to file for later reading
// -->

About this project
Cookie Jar makes saving and retrieving cookie information as easy as using an associative array. The Cookie Jar was created because I was using a lot of cookies in a project and began noticing some of the cookies would expire too quickly. It turns out browsers have a limit to the amount of cookies they will allow, and once that limit is reached, they simply drop the oldest ones. This is why you sometimes are logged out of sites that you haven't been to in a while. With Cookie Jar, you can save all site information in one cookie. Now certain information won't be lost because it hadn't been updated in a while. Logo