Please ensure you read the JSquared documentation for full details on using each JSquared method and object described below
Use the get method to return the value of the specified cookie name. If the cookie does not exist, you will get an empty string.
You can set the value of a cookie using this method. If the cookie does not already exist, then it will be created. You also tell the cookie when to expire by either passing in a number of days to live or a specific expiration date as a Date object. If you do not tell the cookie when to expire, it will become a session cookie. Each time you set the value of a cookie using this method, you need to pass in the correct expiration details.
Set a cookie to expire in 5 days
J2.Cookie.set("nameOfCookie", "value", 5);
Set a cookie to expire on 4 Jan 2010
J2.Cookie.set("nameOfCookie", "value", new Date("4 Jan 2010"));
This will remove the cookie named “nameOfCookie”.
Contribute to this article by sharing your opinion on Twitter:
Use SpeedFactor to track your website. It’s simple and reliable.
See how real people experience the speed of your website. Then find (and fix) your web performance problems.