JavaScript Cookie Library
Technorati Tags : JavaScript, Cookie, Code, Library
Close on the heels of my Generic AJAX Library I have written a cookie handling library.
For those not aware, a cookie is a small bit of data that a developer can leave on your PC to ‘rememember’ things. This technology was enabled because of the stateless nature of HTTP–the protocol that web pages are transmitted in. It allows programmers to leave information, such as your login preferences, on your computer to remember what your preferences were next time you come back to the site.
Most all web development languages and environments have methods of accessing and manipulating these bits of data, but JavaScript’s is very limited. You can read from and write to the document.cookie string, but all of the actual data formatting or interpreting is left to you to do manually.
This being the case, I have been wanting to write an OOP based version of a library that provides this functionalty to programmers in the JavaScript environment. Others have done the same in the past, and I am not claiming mine is much better. But I didn’t find everything that I was personally looking for in the ones I saw out there, and I love writing things myself. My friend Dustin has mentioned it before, and I agree with him–sometimes it’s better, even more fun, to re-invent the wheel. It also doesn’t hurt to get more examples of such code out there to help others who are Googling about hopelessly needing something like this.
So, I’ll leave you to my demonstration page for the Cookie Library, better known as cookieLib. Enjoy!
Powered By Qumana
9 Comments
RSS feed for comments on this post. TrackBack URI
Sorry, the comment form is closed at this time.
November 2nd, 2005 @ 1:09 pm
Very nice Jim. Now you just have to get DMS to work. ;o)
November 2nd, 2005 @ 1:11 pm
If I could only develop the passion for DMS that I have for JavaScript!
November 2nd, 2005 @ 1:19 pm
Awesome, sometimes reinventing the wheel is fun
November 2nd, 2005 @ 2:13 pm
Jim, this is great… and it makes so much more sense. No more flustering with 5 separate functions just lying around in my js files. You can definitely count on me stealing this. It might even find it’s way into some big sites
November 2nd, 2005 @ 2:15 pm
Thanks Dustin! You get my name into the ears of the folks that run those big sites, and you can use anything I write anytime you want!
November 2nd, 2005 @ 9:59 pm
Looking sweeeet! Keep up the good work.
November 4th, 2005 @ 12:15 am
huh? I’m confused…but I do like cookies.
November 4th, 2005 @ 8:32 am
mmmm…cookies.
May 20th, 2006 @ 7:37 pm
[…] Several months ago, I wrote a JavaScript library for cookie interaction. I have now updated it to version 1.1. […]