is there anyway to get the cookie and destroy it in javascript? Thanks in advance!

Recommended Answers

All 3 Replies

set the cookies expiration date to an earlier time than now.

// FUNCTION TO DELETE A COOKIE
function deletecookie(name) {
		var expdate = new Date();
		expdate.setTime(expdate.getTime() - 1);
		document.cookie = name += "=; expires=" + expdate.toGMTString();
}

A comprehensive guide to handling javascript cookies.

I don't know why, but that title brought to mind Godzilla stomping a cookie factory. :icon_mrgreen:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.