Cookie redirect problem
I recently used this script:
to redirect visitors to their specified regional web site.
So, if the url is:
They can choose to go to one of the following:
It works great, but there's no way for the user to CHANGE their chosen location - so if they get it wrong, the will always be directed to uk, when they want to be directed to us when they next visit example.com
I tried to add the same script to a bunch of buttons on the second landing page to allow the user to update the cookie, but it just seems to add a second cookie to THAT page, which really confuses the browser!!
Any ideas anyone?
Thank in advance!
Try setting the path to '/':
Delete existing cookies before testing it.
onClick="SetCookie('animal', this.name, exp, '/');"
Thanks for this. So should I use the same script on the subsequent pages?
Or should I remove the "/" for those?
I got it to work - thank you so much! all i needed to do was add the '/' to all pages and it simply overwrote the cookie each time.
Thanks so much!!