cookie-1.8.js Help


Helps: cookie.js, 1.8


NOTE: All of the matching function parameters are of the same type.

  1. SetCookie ( CookieName, CookieValue, CookieExpiresInDays )
  2. GetCookie ( CookieName )
  3. GetCookieValue ( CookieName, CookieDefaultValue )
  4. GetCookieValueAndSetDaily ( CookieName, CookieDefaultValue )

Example Usage

The following code can easily be loaded with every page load, and will make it less likely for visitors to need to reconfigure all of their settings again. Simply add it to the global-variables.js file.

1. SetCookie()

SetCookie ( CookieName, CookieValue, CookieExpiresInDays )

Self explanatory except for CookieExpiresInDays, which is the number of days before the cookie expires. 365 is used when GetCookieValueAndSetDaily() is called.

2. GetCookie()

GetCookie ( CookieName )

This function can be used to get a cookie value.

3. GetCookieValue()

GetCookieValue ( CookieName, CookieDefaultValue )

This will set a cookie to CookieDefaultValue when a cookie does not exist. CookieDefaultValue works as empty space '' or even null. If you don't need CookieDefaultValue, just use GetCookie().

4. GetCookieValueAndSetDaily()

GetCookieValueAndSetDaily ( CookieName, CookieDefaultValue )

This works the same as GetCookieValue(), and it will push the expiry date by another 365 days.