Jump to content

Cookies different with http:// and www.


Mutley

Recommended Posts

Yeah, if you're not setting the domain in your cookie, it defaults to the domain where it's set. And http://mysite.com isn't the same domain as http://www.mysite.com. To make the cookie available on all subdomains, set the domain as ".mysite.com".

I never noticed you could set the domain when setting a cookie so I usually fixed this with a redirect to a domain starting with www.

 

Is either of these methods better than the other.

 

Initially, I'd have to say the redirect is preferred because the user might browse to http://domain.com and then click on a link pointing to http://www.domain.com.  Not a problem for the cookies, but if you have JavaScript in each page that needs to access objects in the other you will have problems there.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.