(New pick not verified)
Returns the value of Document.cookie as a name/value pair object//assuming that the value of the cookie is stored using the function GetCookie () {VAR () encoded with the encodeURIComponent () functions cookies = {}; Initialize the last object to return var all = Document.cookie; Gets all the cookie values in an uppercase string if (all = = = "") { //If the cookie attribute value is an empty string return cookie; Returns an empty object } var list = All.split (";") Separation of Fame/value pairs for (var i = 0; i < list.length; i++) { //traversal per cookie var cookie = list[i]; var p = cookie.indexof ("="); Find the first "=" sign var name = cookie.substring (0,p); Get cookie attribute name var value = cookie.substring (p+1); Gets the value of the cookie corresponding to decodeuricomponent (value); Decodes its value cookies[name] = value; Store a name/value pair in an object } return cookies;
JS Read Cookie