homepage Welcome to WebmasterWorld Guest from 54.198.8.124
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
COOKIES: .somedomain.com and somedomain.com
iamvela




msg:4127035
 1:19 am on May 5, 2010 (gmt 0)

What is the difference between cookies stored for
.example.com and example.com

(NOTICE the leading dot)

Is this just a JS vs PHP difference or is there more to it?

[edited by: incrediBILL at 2:01 am (utc) on May 5, 2010]
[edit reason] Only use EXAMPLE.COM for sample domain names [/edit]

 

penders




msg:4166396
 9:21 am on Jul 8, 2010 (gmt 0)

Essentially the same AFAIK, the leading dot is not strictly required. The domain is tail-matched with the domain in the URL. However, it apparently makes it compatible with more browsers.

Having said that, however, the HTTP Cookie Specification [curl.haxx.se] does state...
...domains must have at least two (2) or three (3) periods in them to prevent domains of the form: ".com", ".edu", and "va.us". Any domain that fails within one of the seven special top level domains listed below only require two periods. Any other domain requires at least three. The seven special top level domains are: "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT".


Which would imply that you need to specify ".example.com" (with a leading dot)?

Cookies are part of the HTTP protocol, so it shouldn't matter whether you are using JS or PHP in this respect.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved