Stay informed

Thanks. We've added you to our list.


Abobe Business Catalyst Parter specialising in Web Development and BC integration.

Go Back

Create Cookies with one line of code.

by Gary Swanepoel

Aug 10, 2012 Comments (1) share

Ever struggled to get cookies to work on your Business Catalyst site? Written your own, used 3rd party plugins or just tried to get your head around how the thing works?

We've got a neat little way to easily create and manage your cookies with one line of code.

Cookies are a pretty basic element of web development, but can be a little complicated to understand and use if you're a noob.

But it actually is pretty easy to do.


     createCookie('CookieName','Your Cookie Value',1);


No way, you say? Yes way, Jose. And you can also read and erase cookies with the readCookie('CookieName'); and eraseCookie('CookieName'); functions.

How does all work?

You may not be aware, but BC already uses cookies throughout the system, especially with the eCommerce functionality. If you look at the source code for the shopping cart you'll see the Java_Cookies.js script.

By piggy-backing off the built-in code you'll avoid duplicating sometimes conflicting scripts meaning less hair pulling and more key punching.

Just remember though, like any BC feature, they can change it at any time. But it's a fairly standard script, and well integrated into the system so I think you'll have more than enough notice to implement changes into new sites.

1 Comments so far

frompaul wright 19-Nov-2012 08:23 PM

excellent Ive been using 3rd party Cookie plugins for jquery
Back to Top
Post your own comment

Captcha Image