- Here is a basic example:
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
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.