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

Setting a cookie

Discussion in 'XenForo Questions and Support' started by Mike Creuzer, Feb 28, 2012.

  1. Mike Creuzer

    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).

  2. Onimua

    Onimua Well-Known Member

    How are you wanting to do it? It could be done via PHP:
  3. Mike Creuzer

    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 :)
  4. Onimua

    Onimua Well-Known Member

    Ah, sorry. Take a peak at xenforo.js, you could end up just using:
        jQuery.setCookie('name', 'value');
    Mike Creuzer likes this.
  5. Mike Creuzer

    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)

Share This Page