Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Query on retrieving cookies through javascript

Reply
Thread Tools

Query on retrieving cookies through javascript

 
 
vipul
Guest
Posts: n/a
 
      03-26-2008
Hi,

Is there any way by which we can retrieve those cookies through
javascript which have path set to other than root "/".

When I try to fetch the cookies with the help of document.cookie, only
those cookies are being retrieved which have path set as root.

Regards,
Vipul
 
Reply With Quote
 
 
 
 
Bart Van der Donck
Guest
Posts: n/a
 
      03-26-2008
vipul wrote:

> Is there any way by which we can retrieve those cookies through
> javascript which have path set to other than root "/".
>
> When I try to fetch the cookies with the help of document.cookie, only
> those cookies are being retrieved which have path set as root.


It depends on the URI that reads out the cookies. For instance, if a
cookie was set with a path '/html', then document.cookie returns the
cookie only if the caller page resides in directory '/html' on the
server. Paginae outside of '/html' cannot read that cookie, since it's
only accessible from '/html'.

'/' as default root path means that any cookie from a domain can be
read by any page from that same domain. If you set a path like '/html/
mypage.htm', then the cookie can only be accessed from that page.

Hope this helps,

--
Bart
 
Reply With Quote
 
 
 
 
vipul
Guest
Posts: n/a
 
      03-28-2008
On Mar 26, 2:40*pm, Bart Van der Donck <(E-Mail Removed)> wrote:
> vipul wrote:
> > Is there any way by which we can retrieve those cookies through
> > javascript which have path set to other than root "/".

>
> > When I try to fetch the cookies with the help of document.cookie, only
> > those cookies are being retrieved which have path set as root.

>
> It depends on the URI that reads out the cookies. For instance, if a
> cookie was set with a path '/html', then document.cookie returns the
> cookie only if the caller page resides in directory '/html' on the
> server. Paginae outside of '/html' cannot read that cookie, since it's
> only accessible from '/html'.
>
> '/' as default root path means that any cookie from a domain can be
> read by any page from that same domain. If you set a path like '/html/
> mypage.htm', then the cookie can only be accessed from that page.
>
> Hope this helps,
>
> --
> *Bart


Hi Bart,

Thanks for replying.
The issue is that I can not change the location of the form. I am
still struggling with the issue

Thanks,
Vipul
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
Retrieving Cookies asg Javascript 1 05-15-2006 08:56 PM
Response.Cookies vs Request.Cookies Alex Nitulescu ASP .Net 1 02-03-2005 09:43 AM
Retrieving cookies from a webserver Peter v.d. Berger Perl Misc 1 09-26-2004 11:40 PM
Retrieving cookie data through document.cookie (Javascript) Vikram Bhatia Javascript 1 10-11-2003 12:54 PM



Advertisments