我正在为 .example.com
设置 cookie。我知道 cookie 是随请求发送到 www.example.com
和 secure.example.com
的,但是它会随请求发送到 server.www .example.com
? long.sub.domain.name.for.example.com
怎么样?
最佳答案
我不明白 manual冷得更清楚:
The domain that the cookie is available to. Setting the domain to 'www.example.com' will make the cookie available in the www subdomain and higher subdomains. Cookies available to a lower domain, such as 'example.com' will be available to higher subdomains, such as 'www.example.com'. Older browsers still implementing the deprecated » RFC 2109 may require a leading . to match all subdomains.
如果您不喜欢这个解释,测试它只需不到 5 分钟
one.two. Three.example.com
高于 third.example.com
两者都是 example.com
关于javascript - 为 .example.com 设置的 cookie 是否适用于所有子域或仅适用于第三级域?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21687381/