Forum Moderators: open

Message Too Old, No Replies

Cookies created on one page not visible on another

Cookies created on one page not visible on another

         

sargek

7:51 pm on Jun 26, 2006 (gmt 0)



I have a reminders calendar which sets persistent cookies to store the reminders. I would like to have the reminder data available on another page in the same intranet site (same domain), but cannot retrieve the cookie information. To test this, I ran:


<script language="javascript" type="text/javascript">
var ca = document.cookie.split(';');
</script>

on both pages, and the data I need is only available on the page it is written. Is this because the domain and path document.cookie is reading from are page specific? Thanks in advance...

texmex

12:19 am on Jun 27, 2006 (gmt 0)

10+ Year Member



it sounds like you may have a problem with the method you are using to set the cookie. If you specify a path (other than / ) it will not be available in any other directory in your site.

You may also have a problem if you are not correctly specifying the expiry date.

Show us the code you are using to set the cookie. I'll wager that is where your problem lies.

Rambo Tribble

3:14 am on Jun 27, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cookies are, in fact, domain specific. It is part of security. The Same Origin Policy, I believe it's called.

texmex

1:39 pm on Jun 27, 2006 (gmt 0)

10+ Year Member



Although they can also be directory specific, if you set them that way.