Posted By

abwaters on 06/07/09


Tagged

cookies


Versions (?)

Getting a Cookie in Javascript


 / Published in: JavaScript
 

URL: http://www.arachna.com/edu/tutorials/mini/cookies/javascript.html

  1. function getCookie(name) {
  2. var cookies = document.cookie.split(/[; ]+/);
  3. for (var i = 0 ; i < cookies.length; i++) {
  4. if (cookies[i].substring(0,cookies[i].indexOf('=')) == name) {
  5. return cookies[i];
  6. }
  7. }
  8. }

Report this snippet  

You need to login to post a comment.