By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,962 Members | 1,967 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,962 IT Pros & Developers. It's quick & easy.

Can I get cookies from other than the current path?

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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.