Skip to content

Dough is an easy to use cookie plugin for jQuery with powerful features. Dough can auto set your domain name with ‘.’ prefix so your cookies work with subdomains and will allow you to easily go from local to staging to product servers with out a problem.

Notifications You must be signed in to change notification settings

nwcode4hire/Dough

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

20 Commits

Repository files navigation

Dough, A Cookie Plugin for jQuery

Dough is an easy to use cookie plugin for jQuery with powerful features. Dough can auto set your domain name with ‘.’ prefix so your cookies work with subdomains and will allow you to easily go from local to staging to product servers with out a problem.

Info

Developed by Nathan Searles, http://nathansearles.com

For updates, follow Nathan Searles on Twitter

Dough is licensed under the Apache license.

Examples and Instructions

Check out an example at http://nathansearles.com/plugin/dough/

Create cookie
$.dough("cookieName", "cookieValue");

Read cookie
$.dough("cookieName");

Delete cookie
$.dough("cookieName", "remove");

Note: If setting the path to “current”, you must also define that when removing the cookie.

$.dough("cookieName", "remove",{path: "current" });

Set full cookie
$.dough("cookieName", "cookieValue",{expires: 365, path: "current", domain: "auto", secure: true });

Example cookie has a name of “cookieName”, a value of “cookieValue”, will expire in 1 year, have path of current page, domain will be autodetected and is set to secure for a use under https://.

Definition
$.dough([name], [value],{[options] });

JSON Support

Create JSON cookie
$.dough("jsonCookie", "{'someName':'someValue','someOtherName':'someOtherValue'}");

Read JSON cookie
$.dough("jsonCookie").someName;

That will return ‘someValue’

Options Definition

  • expires: Days ’til cookie expires
  • path: Default is root ‘/’, set to ‘current’ to use the path of current page
  • domain: Auto detect and set domain with subdomain prefix
  • secure: Set to true if you’re using https://

Changelog

  • 1.3
    • Fixed: issue with JSON detection
  • 1.2
    • Fixed: issue with auto domain detection
    • Cleaned up a few things
  • 1.1
    • New: Support for JSON in cookie value
  • 1.0
    • Initial release

About

Dough is an easy to use cookie plugin for jQuery with powerful features. Dough can auto set your domain name with ‘.’ prefix so your cookies work with subdomains and will allow you to easily go from local to staging to product servers with out a problem.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published