Please read on how to read / write cookies in JavaScript.
http://www.quirksmode.org/js/cookies.html
You might be looking for a solution like this: Get all cookies with Javascript
The following function loads all cookie elements into an associative array with the cookie name as index and cookie value as value:
function get_cookies_array() { var cookies = { }; if (document.cookie && document.cookie != '') { var split = document.cookie.split(';'); for (var i = 0; i < split.length; i++) { var name_value = split[i].split("="); name_value[0] = name_value[0].replace(/^ /, ''); cookies[decodeURIComponent(name_value[0])] = decodeURIComponent(name_value[1]); } } return cookies; }
After that, you can get the cookies and write them to the document as follows:
var cookies = get_cookies_array(); for(var name in cookies) { document.write( name + " : " + cookies[name] + "<br />" ); }
source share