Thursday, August 8, 2013

Create a Cookie in Javascript

Create a cookie in javascript

document.cookie="unCheckedIds="+c_ids+";path=/";

Here unCheckedIds is the name of the Cookie and c_ids will have the value of the Cookie. Path "\" is used to use the cookie in the domain level and not for the page level.

If path is not given, by default it will opt for page level.

Other parameters like path are expiry and domain.

No comments:

Post a Comment