469,923 Members | 1,357 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

Can I get cookies from other than the current path?

Using Javascript, you can call document.cookie to get a list of all the
cookies that will be sent to the path of the current document. Is
their a way to get all the cookies associated with the current domain
without regard to the path of the current document?

For example, if there is a cookie with path=/foo and a cookie with
path=/bar, and I have javascript in the page /foo/cool.html: Can I
query the cookie with the path of /bar as well as the cookie with the
bath of /foo? By default, document.cookie only returns the cookies
that would be sent with an HTTP request to /foo.

Thanks,
Dave

Sep 13 '05 #1
1 2050
On 13/09/2005 21:17, UncleStoner wrote:
Using Javascript, you can call document.cookie
Correction: you can read the property. It isn't a function.
Is their a way to get all the cookies associated with the current domain
without regard to the path of the current document?


No. That would be a security violation. Consider service providers and
hosts that assign users subdirectories not (sub-)domains. However, you
can assign a directory when setting the cookie (using the path
parameter) that is common to both documents.

Mike

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Sep 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Brian Burgess | last post: by
7 posts views Thread by Brian Burgess | last post: by
2 posts views Thread by Citoyen du Monde | last post: by
6 posts views Thread by Mark | last post: by
12 posts views Thread by Patxi | last post: by
5 posts views Thread by Kevin Blount | last post: by
1 post views Thread by Simon Wigzell | last post: by
5 posts views Thread by pbd22 | last post: by
3 posts views Thread by Inny | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.