Drupal 7 and the jquery cookie plugin
Nov. 18th, 2011 02:19 pm![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
This is a blog post copied from John's Website - please feel free to join him there and post comments. He has set up openid, so you can post there with your livejournal account using your openid, which is the same as your journal url minus the http://. You can find this entry at http://www.jcfiala.net/blog/2011/11/18/drupal-7-and-jquery-cookie-plugin.
Here's a quick snippet I just found out today: The jquery cookie plugin is presented as part of Drupal 7. This is really cool and useful, but I must note that it's not automatically included on every page load, so you'll want to include it if you want to use it, and as well it doesn't seem to actually be documented anywhere on drupal.org.
Happily, the original documentation for the plugin is at https://github.com/carhartl/jquery-cookie/blob/master/README.rdoc, and is pretty good, although I suggest reading it through at least twice, as at first I missed that you can read, as well as set, cookies with this. Basically the parameters are the cookie name, the cookie value, and then an options object which says the expiration, the path, the domain, and such. Note that the expiration can _either_ be a date, or a number of days.
Hopefully this will help other folks out with using the jquery cookie plugin with Drupal 7.