jsCookie – Easy to use JavaScript Cookie Library (Miscellaneous)

is a simple, fast JavaScript Library that will help you handle cookies the easy way!

jsCookie is designed to change the way you handle JavaScript Cookies.

Are you tired of the “document.cookie” element?
You want to have full control over cookies and make it simple to use.
Be sure to get the best solution out there, make your life easier!
Get jsCookie.

Features:

jsCookie is designed for rapid development and ease of use.

Every problem can be solved easily with the documentation.

Compatible with all major web browsers!

Lightweight and easy to implement!

Implementation:

1) Include jsCookie into your html file:
Just copy this code into your html file and paste it before the closing “head” tag or the closing “body” tag.
Like so:

<script src="your/path/jsCookie.js"></script>

2) Call jsCookie
In the script tag where you want to use jsCookie, add the following lines:
(before using the jsCookie functions, otherwise it will not have time to load)

var jsCookie = new jsCookie();

3) Start coding!

Functions:

  • .enabled() – check the availability of cookies on the client’s browser.
  • .create() – creates or updates a cookie.
  • .set() – creates a session cookie which exists only while the browser window remains open.
  • .read() – returns the value of the specified cookie.
  • .readByValue() – returns the name of the cookie’s value that was specified.
  • .remove() – deletes a cookie by it’s name.
  • .removeByValue() – deletes a cookie by its value.
  • .removeAll() – deletes all the cookies (only those in the current path).
  • .count() – returns the number of cookies on the page.
  • .getNames() – returns all the cookies’ names in the current page.
  • .getValues() – returns all the cookie values in the current page.
  • .getAsArray() – returns cookies and their data as an array.

Updates:

  • (6/29/2011)Tune up for the next update, it will have a fix for the prototype object. :)[]-Done!

Download jsCookie – Easy to use JavaScript Cookie Library (Miscellaneous)

Leave a Reply

Your email address will not be published. Required fields are marked *