...

View Full Version : Setting cookies across multiple domains



x452
06-19-2007, 03:42 AM
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

smalldog
06-19-2007, 04:10 AM
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

glenngv
06-19-2007, 05:02 AM
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.

www.yahoo.com
mail.yahoo.com
photos.yahoo.com

x452
06-20-2007, 12:38 AM
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?


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.

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.

x452
06-21-2007, 08:06 AM
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.

_Aerospace_Eng_
06-21-2007, 08:09 AM
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.

x452
06-22-2007, 12:03 AM
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?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum