Click to See Complete Forum and Search --> : Redirect by Ronnie T. Moore How do I reset??


houseofstrauss
04-19-2003, 11:40 AM
I'm using the excellent redirect script by Ronnie T. Moore Except I have a problem: I need to be able to delete the cookie 'animal' in order to access the options again. It seems obvious but when an option is set the page is no longer available as it becomes a redirect page. So How am I able to get back to it to change the options? Ive tried a number of js delete cookie scripts on a separate page, but they dont work. Any Ideas, yes, iv'e searched the forum.

Many thanks (you can tell.. fairly low level on js.)

Richard.:confused: :confused:

DrDaMour
04-19-2003, 12:16 PM
the idea behind deleteing a cooke is changing teh expire date to before the current time, so just use your set cookie function and a negative time


SetCookie("name","whocares","-500");

i cna't remember if you use quotes or not, i don't think it even matters

that shoudl delete it, what i suggest is that your link to options board call a function taht does this, THEN redirects them to the options board. (using window.location.href)


edit:

a lot of sites will just have a secondary options page that doesn't check for cookies, but does set them.

houseofstrauss
04-20-2003, 08:19 AM
Here is the url for the script that I have place on my page http://javascript.internet.com/cookies/cookie-redirect.html

Im using this script to divert visitors to different entry points on my site, according to their preferences.

However, They need to be able to return to the preferences page holding this sript if they want to change their options.

My ideal solution would be when a visitor cliks to view this options page it ignors any cookies set that would initiate the redirect, thus disallowing the options page to be viewed to make changes

2 failed attempts
1/ <a href="#" onClick="javascript:delCookie('animal')">Click here to reset your options.</a>

2/ <script language="javascript">
function DeleteCookie(animal) {
var expire = new Date ();
expire.setTime (expire.getTime() - (24 * 60 * 60 * 1000));
document.cookie = name + "=; expires=" + expire.toGMTString();
}

</script>

Thanks Richard.

houseofstrauss
04-21-2003, 11:29 AM
Dave,

Thank-you for your solution to the problem. It works just fine and now makes the script very useable for me. Im going to try and figure out what you've done, and also, if you dont mind put a link to your site.

Richard :)