jsCookie - Easy to use JavaScript Cookie Library

Last Update
13 April 2013
Regular License
$3
Extended License
$15
Sales
69

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? Do you want to have full control over cookies? in a simple manner? Be sure to get the best solution out there, make your life easier! Get jsCookie.

Updates:

Update 1.4: – [] .

1 New function getNamesByValue(). Modified getAsArray() to return an object literal. Code improvements (lint tests and more). Updated Documentation.

Update 1.3: – [] .

3 New functions ( update(), appendValue() & getSettings() ). Updated Documentation. Minor Code improvements.

Update 1.2 : After several complaints about errors, I decided to update jsCookie – [] .

Run-time errors – fixed! Dev tool updated. Better integration with jQuery

The first major update, code-named “jsCookie-1.1”. []-Done!

Minifyied version of jsCookie.(2.74k”b instead of 5.78k”b) Updated documentation. Developer tool that checks jsCookie’s functions.

Fix for the prototype object. :)[]-Done!

Example:

jsCookie.create("name","value",[0,1,0,0]); //create a cookie that expires in 1 hour console.log(jsCookie.read("name"));//outputs: "value"

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!

Testimonials: mordauk:“Went ahead and picked this up and I am so glad I did! Worked perfectly!” eonic81:“Something I’ve waited a long time. Thank you very much!” etaous:“Useful and easy-to-use cookie library, excellent email support, thanks Agam.” indalab:“This library is definitely worth having & easy to use.” urbancool:This script and Agam’s help/unique customer support was top notch from start to finish! Don’t dwell on buying from this author, he is sure to be an elite author very soon!

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-1.3.min.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 jsc = 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.

.update() – update cookies while maintaining their old settings.

.appendValue() -append values to already existing cookies.

.getSettings() – read and updatable cookie’s settings (expire date, path, domain, secure). Update 1.4:

.getAsArray() – returns cookies and their data as an array or object literal.

.getNamesByValue() – get cookies names by their common value

Note:Using with a jQuery fasion: 1) Add the following line to the end of: jsCookie-1.4.min.js $.jscookie = jsCookie.prototype; 2) Use jsCookie like so: $.jscookie.method(); Example:alert($.jscookie.enabled());