Query on retrieving cookies through javascript

V

vipul

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
 
B

Bart Van der Donck

vipul said:
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,
 
V

vipul

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,

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top