List Cookies

List cookies that have been set for a web site:
// split up cookie into array (;  is deliminator)
thisCookie = document.cookie.split('; ');
// loop through array
if(thisCookie.length > 0){
	// open list
	document.write('<ul>');
	for(i=0;i<thisCookie.length;i++){
		// cookie name
		document.write('<li><strong>Cookie Name:<\/strong> ' + thisCookie[i].split('=')[0]);
		// cookie value
		document.write(', <strong>Value:<\/strong> ' + unescape(thisCookie[i].split('=')[1]) + '<\/li>');
	}
	// close list
	document.write('<\/ul>');
}
Use for seeing what cookies your site has set.

Comments

Popular posts from this blog

Select box manipulation with jQuery

iTextSharp: Generating a Basic PDF file (ASP.NET/C#)

Popup Window Countdown (JavaScript)