www.webdeveloper.com
Results 1 to 4 of 4

Thread: Cookie redirect problem

  1. #1
    Join Date
    May 2010
    Posts
    3

    Cookie redirect problem

    Hi there,
    I recently used this script:
    http://javascript.internet.com/cookies/

    to redirect visitors to their specified regional web site.

    So, if the url is:

    example.com

    They can choose to go to one of the following:

    example.com/uk
    example.com/us

    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!

    Andy

  2. #2
    Join Date
    Jun 2007
    Posts
    667
    Try setting the path to '/':
    Code:
    onClick="SetCookie('animal', this.name, exp, '/');"
    Delete existing cookies before testing it.

  3. #3
    Join Date
    May 2010
    Posts
    3
    Thanks for this. So should I use the same script on the subsequent pages?
    Or should I remove the "/" for those?

  4. #4
    Join Date
    May 2010
    Posts
    3
    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!!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles