View Full Version : cookies stored on localhost
10-20-2003, 12:58 PM
I would like to know if cookies are stored when testing website on localhost?
The problem I am having is when I view the site locally my cookie script is finding two different values for the same cookie. I think its taking one value from the 'local cookie' and the other from when I view the site on a 'LIVE' host (internet).
10-24-2003, 12:47 PM
10-24-2003, 02:28 PM
Cookies are depending on the domain - so if you are loading the document from a different domain, it will nto have access to the cookies it set on the other domain. And localhost is not only another domain but an entirely different protocol (I guess you mean localhost as in using the file protocol), unless you have a local server running from which you load the file.
10-29-2003, 09:14 AM
thankyou for replying...
Cookies are depending on the domain so if you are loading the document from a different domain, it will nto have access to the cookies it set on the other domain
From this, my understanding is that if a user logged onto www.mydomain.com - a cookie is created with this domain, and if a user accesses www.mydomain.co.uk - a different cookie would be created and the values from the .com cookie would not be used. Is there any code I can use to set or retrieve data from cookies from a specific domain and ignore all else?
10-29-2003, 11:49 AM
you can only retrieve the cookie that matches the current document's domain with the cookie's domain attribute.
10-29-2003, 03:43 PM
You can SET a cookie for another domain, however. Whether the browser accepts it depends on the settings and the user.
10-31-2003, 10:58 AM
So if I wanted to set a cookie for any domain name that contained 'mydomain' and only use the values from this cookie - would this be possible?
I have purchased lots of domain names - (they all have the same) -
mydomain.co.uk and so on....
If a user enters my site using '.com' a cookie is set, the user leaves the site and at a later date returns to my site but this time the user uses '.co.uk' - I want to use the values from the '.com' cookie for this user.
Is this possible?
10-31-2003, 11:03 AM
No. You have to set the cookie explicitly for each domain you want.
11-01-2003, 12:31 PM
Thankyou very much for your help and support.
11-04-2003, 01:16 PM
if you have subdomains like below:
you can set the cookie domain as ".mydomain.com" so that the cookie is visible to all subdomains with that domain.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.