Answers.Body: <p>For now, you have to use a plugin</p>
  
  <p>I recommend one of these 2</p>
  
  <ol>
  <li>Craft Cookies Plugin <a href="https://github.com/nystudio107/craft-cookies" rel="nofollow noreferrer">https://github.com/nystudio107/craft-cookies</a></li>
  <li>Craft LJ Cookies Plugin <a href="https://github.com/khamer/craft-lj-cookies" rel="nofollow noreferrer">https://github.com/khamer/craft-lj-cookies</a></li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T05:17:24.973Z
Answers.LastActivityDate: 2020-03-28T05:17:24.973Z
Answers.UserDisplayName: Tunji Oyeniran
Answers.Body: <p>So far the only solution I have found is to use a plugin, and Lewis Jenkins' <a href="https://github.com/khamer/craft-lj-cookies" rel="nofollow noreferrer">LJ Cookies plugin</a> does the trick nicely:</p>
  
  <pre><code>{{ craft.lj_cookies.get( NAME ) }}
  </code></pre>
  
  <p>It also allows you to set and delete cookies within templates.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-02T22:05:22.150Z
Answers.Text: It really bugs me that I have to have a whole plugin just to access a cookie set from JS. That's a very "Wordpress" solution to a problem. The Craft guys need to figure out a correct way to do this. Given how ajax heavy most sites are it's a super common way to set cookies. Not much good if you can't get the values back.
Answers.UserDisplayName: JamesNZ
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T05:15:12.500Z
Answers.Text: Please update the LJ Cookies Plugin Github Repo to https://github.com/khamer/craft-lj-cookies
Answers.UserDisplayName: Tunji Oyeniran
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T18:12:46.600Z
Answers.Text: Updated, thanks!
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2014-09-15T12:16:29.800Z
Answers.LastActivityDate: 2020-03-28T18:12:33.823Z
Answers.LastEditDate: 2020-03-28T18:12:33.823Z
Answers.UserDisplayName: Ben Croker
Body: <p>The <a href="https://docs.craftcms.com/v2/templating/craft.request.html#getcookie-name" rel="nofollow noreferrer">docs</a> state that <code>{{ craft.request.getCookie(name) }}</code> will not work for cookies that were set in JavaScript, because all cookies in Craft go through some validation to ensure that they aren't tampered with. </p>
  
  <p>This is understandable, but is there any way of getting non-Craft cookies with twig?</p>
  
Tags: <templating><cookies><javascript>
Title: How can I get cookies that were set in javascript from a twig template?
ThreadText: # How can I get cookies that were set in javascript from a twig template?
  
  (Asked by: username_0 on 2014-09-15)
  
  The [docs](https://docs.craftcms.com/v2/templating/craft.request.html#getcookie-name) state that `{{ craft.request.getCookie(name) }}` will not work for cookies that were set in JavaScript, because all cookies in Craft go through some validation to ensure that they aren't tampered with.
  
  This is understandable, but is there any way of getting non-Craft cookies with twig?
  
  **Tags:** templating, cookies, javascript
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2014-09-15. Score: 7 | Accepted answer
  
  So far the only solution I have found is to use a plugin, and Lewis Jenkins' [LJ Cookies plugin](https://github.com/khamer/craft-lj-cookies) does the trick nicely:
  
  ```
  {{ craft.lj_cookies.get( NAME ) }}
  
  ```
  
  It also allows you to set and delete cookies within templates.
  
  > **Comments:**
  > **username_2**: It really bugs me that I have to have a whole plugin just to access a cookie set from JS. That's a very "Wordpress" solution to a problem. The Craft guys need to figure out a correct way to do this. Given how ajax heavy most sites are it's a super common way to set cookies. Not much good if you can't get the values back.  
  > **username_1**: Please update the LJ Cookies Plugin Github Repo to https://github.com/khamer/craft-lj-cookies  
  > **username_0**: Updated, thanks!  
  
  ---
  
  ### Answer by username_1 on 2020-03-28. Score: 1
  
  For now, you have to use a plugin
  
  I recommend one of these 2
  
  1. Craft Cookies Plugin <https://github.com/nystudio107/craft-cookies>
  2. Craft LJ Cookies Plugin <https://github.com/khamer/craft-lj-cookies>
  
  
  ---
  
  