Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

simple cookie question

Status
Not open for further replies.

spicymango

Programmer
May 25, 2008
119
CA
I have a domain istraders.com. I set the cookie in the index.html file.
Code:
document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();


As you see I do not define name of the domain in my cookie code.
So by default it sets the cookie under domain istraders.com.


Now suppose I get redirected to subdomain which is like


Now from this domain can I read the cookie which I set it up for istraders.com?
 
Thanks a lot. I set the cookie with out domain name. If cookie get setup by hitting
Its is not readable by if I hit the site again by just typing istraders.com

Now he is saying in that article even if I set it up with .domain.ext

there it will have same issue
 
Dianceht the article that sent link of talks about

"If the cookie domain is set to ".domain.ext", it will not be accessible by a user
who types in the address without the the domain (i.e. "
That statemenmt I think is not correct. Because I tested
even though I put domain with "dot" like .mysite.com I can still access from both and
document.cookie = cookieName+"="+escape(cookieValue)
+ ";expires="+expire.toGMTString() + ";path=/; DOMAIN=.mysite.com";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top