My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

Source can be found at: https://github.com/NJLaPrell/ezcookie

ezCookie is a jQuery plugin for reading and writing cookies in many useful ways. Cookies can be stored as regular strings or JavaScript objects. This plugin uses JSON.org's js2 library to parse JSON strings and convert objects into a JSON string.

March 22, 2012

I regret to announce that I will no longer be contributing to the ezCookie project. My company was acquired late last year and in the integration process, it was decided that I will not be permitted to continue pursuing projects like this on my own time. I am permitted to continue my projects in an official capacity as an employee, however, the terms are not desirable.

I will leave the source on Github, but will be making no further contributions. If you have found this project useful, I strongly encourage you to fork it and continue its development.

November 5, 2011

Version 0.8.01 addresses a minor bug where an exception was thrown if the expires option was set to an empty string in an attempt to set it as a session cookie.

March 26, 2011

Version 0.8.0 addresses some minor bugs and tweaks, including:

  • $.removeCookie() no longer triggers an exception in IE 9 when the cookie does not exist.
  • $.removeCookie() now accepts the options parameter in order to specify path and domain.
  • $.cookie() has been deprecated in favor of $.getCookie() and $.subCookie() in favor of $.getSubCookie(). The old functions still exist for backwards compatibility, but will be removed in future releases.

My apologies for not being very active with this project. My email notifications were not properly set and I had no idea people were using this and reporting issues. Thank you very much to everyone who reported issues. If this plugin has been helpful to you, I would love to hear how you are using it.

Future Plans

I intend to spend some more time making sure everything works the same across all browser versions. I will also remove deprecated functions by version 1.0. Please don't hesitate to send me any feature requests and bug reports. I intend to be much more responsive in the future.

July 18, 2010

The new 0.7.01 version is an extremely minor update to some internal variable names and inline comments. If you already have 0.7, there is no need to upgrade.

I have finally had a chance to field test the sub-cookie and JSON storage features and feel much more confident in its operation. My testing also included storage of double-byte characters in sub-cookies.

Usage

Functions

$.setCookie(name,value,{options});

Sets the value as the cookie.

name - (string) The name of the cookie.

value - (string/object) The value of the cookie.

options - (object) Optional parameters.

$.getCookie(name);

Returns the value of the named cookie. JSON cookies are auto-detected and returned as objects.

name - (string) The name of the cookie.

$.setSubCookie(name,key,value,{options});

Sets a name/value pair (or "sub-cookie") within a cookie.

name - (string) The name of the cookie.

key - (string) The name of the sub-cookie.

value - (string/object) The value of the sub-cookie.

options - (object) Optional parameters.

$.getSubCookie(name,subName);

Retrieves the value of a given sub-cookie.

name - (string) The name of the cookie.

subName - (string) The name of the sub-cookie.

$.removeSubCookie(name,subName);

Removes the key/value pair of the given sub-cookie.

name - (string) The name of the cookie.

subName - (string) The name of the sub-cookie.

$.removeCookie(name);

Sets the given cookie to an empty string and sets it to expire.

name - (string) The cookie name.

$.clearCookie(name);

Sets the given cookie to an empty string without expiring it.

name - (string) The cookie name.

Options

expires - Sets the expiration date of the cookie. Takes the number of days from present or a date. Default is -1.

domain - The domain to be used for the cookie. Default is an empty string.

secure - Boolean value to use secure cookies. Default is false.

path - Optional cookie path. Default is "/".

Powered by Google Project Hosting