Node.js examples for Environment:Cookie
Read a cookie value
function CookieGet(name) { var ret = ""; name += "="; var allCookies = document.cookie.split(';'); var thisCookie; for(var i = 0; i < allCookies.length && ret == ""; i++) { thisCookie = allCookies[i].Trim();// w w w. j a v a 2 s . c om if (thisCookie.indexOf(name) == 0) ret = thisCookie.substring(name.length).replace(/\[#\]/g, "\n"); } return ret; }