Why client side persistence ?
Web vs Desktop: Desktop allows a lot of options to store data on the client side as it allows us to access information from local files. But the web has a limitation in that respect. Wen do allow some mechanisms to store and load data locally one of them is cookies.
What is a cookie? Cookies are small text based files which holds information in key:value pairs. Cookies are domain specific and don’t allow other domains to access data other than created by themselves.
Example of a cookie file.
firstname=devang;expires=29/04/2008; path=’/'; domain=’/';
This example stores firstname as a cookie and also tells us when it expires and about the domain and the path which are allowed to access the cookie.
Cookies can be used for Session Management, Personalization, Tracking. Lot of information about cookies can be found at More on cookies
Cookies can be used to serialize javascript objects and store them in cookie files. Then when needed they can be deserialized and brought back into application. After deserialization a json is made can be used as a normal Js object.
A js wrapper for loading and saving jsObject is cookieMonster.js. It has got all the functions required to load ,save objetcs to cookies and removing them.
But there are some drawbacks with cookies like
- Inaccuratee Indentification
- cookie hijacking
- cookie theft
- cookie poisoning
- cross site cooking
Information about all these can be found on more on cookies
There are various alternatives available for cookies like
- IP address
- URL (query string)
- Hidden form fields
- window.name
- HTTP authentication
- Adobe Flash Local Shared Objects
So before using cookies analyse our case and if you use cookies make sure you are ready for the drawbacks which cookie offers.
If you want to know how cookies work you can read a super article at howstuffworks.
nJoy !!



























































