Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting cookies across multiple domains

    Hi,

    Say I have the following domains which all direct to the one website:

    www.first.com
    www.first.com.au
    www.firstbank.com
    www.firstbank.com.au
    www.fb.com
    www.fb.com.au

    I want to set the same cookie across all of the above domains, which will be set if the customer uses any of the following addresses:

    www.first.com
    first.com
    www.first.com.au
    first.com.au
    www.firstbank.com
    firstbank.com
    www.firstbank.com.au
    firstbank.com.au
    www.fb.com.au
    fb.com.au
    www.fb.com
    fb.com

    How do I do this?

    Thanks,
    Andrew

  • #2
    Regular Coder
    Join Date
    May 2007
    Posts
    118
    Thanks
    0
    Thanked 0 Times in 0 Posts
    IMHO you can't set the cookie for multiple domains, cookies are automatically set for the actual domain and that's the logic of the browsers.

    You can just make some workaround for this, for example redirect other domains to one domain. For example www.first.com.au redirect to www.first.com/au etc
    Forum for webmasters and developers
    http://www.htmlfrenzy.com
    Are you an IT expert? Join our Reward system
    www.htmlfrenzy.com/reward-system.php

  • #3
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You can set the domain for the different sites with the same subdomain. For example, for the following sites, if you set the domain to .yahoo.com, the cookie is accessible to all of them.
    Code:
    www.yahoo.com
    mail.yahoo.com
    photos.yahoo.com
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #4
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by smalldog View Post
    You can just make some workaround for this, for example redirect other domains to one domain. For example www.first.com.au redirect to www.first.com/au etc
    That sounds like a good idea, I wonder if I can redirect all my domains to www.first.com.au? So if a user goes to www.first.com they will be redirected to www.first.com.au and I wonder if this redirection will be seamless?

    All my domains point to the one web server, would I do the domain redirect at the domain supplier level?

    Quote Originally Posted by glenngv View Post
    You can set the domain for the different sites with the same subdomain. For example, for the following sites, if you set the domain to .yahoo.com, the cookie is accessible to all of them.
    Code:
    www.yahoo.com
    mail.yahoo.com
    photos.yahoo.com
    Yeah I knew about this one but unfortunately it wouldn't work as all my sites are domains rather than sub-domains. So setting the domain to .first.com would not work for first.com or www.first.com.au.
    Last edited by x452; 06-20-2007 at 01:01 AM.

  • #5
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Can the solution in this article be done using javascript? http://www.15seconds.com/issue/971108.htm

    If yes if anyone can give me the code that would be great.

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The answer is no. That article is meant to be used with ASP pages. As said before Javascript can't go across domains due to security reasons. Are all of your URLs hosted on the same server? If they are then you may be able to use a server side script.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #7
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by _Aerospace_Eng_ View Post
    Are all of your URLs hosted on the same server? If they are then you may be able to use a server side script.
    Yes they are. How I could do this with server side script?


  •  

    Posting Permissions

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