jamjam
jamjam

Reputation: 3269

A cookie without a domain?

Is it possible to set a cookie without a domain?

This will mean all domains will have access to it.

Upvotes: 22

Views: 22667

Answers (2)

Michael Petrotta
Michael Petrotta

Reputation: 60902

No, that is not possible. If a cookie doesn't declare a domain, the browser will assume the domain of the object requested.

What you're asking for is generally considered a security, or at least privacy, risk. It's possible to configure browsers to allow access to cookies from other than the domain that they were created, but browsers aren't commonly configured that way.

Upvotes: 20

user1720236
user1720236

Reputation: 81

RFC 2109 tells this parameter is optional. But depending on the browser, behavior may be different.

Upvotes: 7

Related Questions