Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete all cookies I set???

Status
Not open for further replies.

dzr

Programmer
Nov 20, 2001
109
0
0
US
Can anyone tell me why this wouldn't work to delete all cookies? I displays them all fine....

thanks!

function delete_all_cookies(){
//reading and splitting the whole cookie
//reading and splitting the whole cookie
var whole_cookie = unescape(document.cookie);
var each_cookie = whole_cookie.split(";");

for (i = 0; i < each_cookie.length; i++){
var cookie_split = each_cookie.split("=");
document.cookie = cookie_split[1] + "=stub;expires=" + kill_date.toGMTString();
}//ends FOR
}//ends process_cookie() function
 
Delete (expire) each cookie by name
Code:
function deleteCookie(name) {
	var exp = new Date();
	exp.setTime (exp.getTime() - 1);
	document.cookie = name + "=" + name + "; expires=" + exp.toGMTString();
}

M. Brooks
 
but how do i get all the names?

plan was use the document.cookie to get all the cookie names and values, them and put them in array, split array values so i only have the name...

i will have no idea how many cookies are set ... could be 2, could be 50...

thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top