• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Setting a cookie

Mike Creuzer

Well-known member
Hey all,

Was wondering how to set a cookie using (I'm assuming there is a built-in function) XenForo, as I was hoping to be able to do it without loading the jQuery cookie plugin. Could someone provide a basic example of doing this (I'm not the best javascript developer in the world, I'm not quite a master yet :p).



Well-known member
How are you wanting to do it? It could be done via PHP:
XenForo_Helper_Cookie::setCookie('cookieName', cookieinfo, timeout);

Mike Creuzer

Well-known member
Hey there, I want to do with javascript. I can do it the long way or I can import jQuery cookie plugin, but figured there was a way to do it with XenForo and just thought I'd found out how :)

Mike Creuzer

Well-known member
Ah thanks a lot, $.setCookie() and $.getCookie() :D, I couldn't find it until I beautified the xenforo.js file, thanks a lot! (think my find function was buggy)