Here is the documentation for Cookie.js.

The Cookie object, does pretty much what you'd expect. It has three functions:


//let's store "example" as "some value" for 10 days
Cookie.write("example", "some value", {duration: 10});

You can set three (optional) options in the 3rd argument:

Cookie.write("example", "some value", {
	duration: 10, //ten days
	path: "/some/path", //now my cookie is available to
	//only content in this path
	domain: "", //now my cookie is available to any
	//subdomains of,
	secure: true //stored cookie information 
	//can be accessed only from a secure environment

//let's get it now"example"); // -> "some value"


Cookie.dispose("example"); //delete the cookie

Deprecated Methods

  • Cookie.get (see
  • Cookie.set (see Cookie.write)
  • Cookie.remove (see Cookie.dispose)

mootorial/05-utilities/03-cookie.txt · Last modified: 2008/10/27 23:53