Re: Cookies problem



Simon Wigzell wrote on 07 apr 2007 in comp.lang.javascript:

I have discovered that saved cookie only apply to pages loaded from
the directory in which they are set. That is, if you set a cookie from
a page in your website domain root directory then load a webpage from
a directory below the root then that page will not understand the
cookie. And vice versa - if you set a cookie in a webpage in a sub
directory of the root then it won't be understoon by pages in the
root. This is in IE anyway, I have not tried other browsers.

You are wrong.

Pages from directories "below the root" do not belong to the website,
so they normally cannot even be requested on the web.

Other subdirectory files can read the cookies having the root path '/'.
Perhaps you did not or did wrongly set the cookie path?

<http://www.quirksmode.org/js/cookies.html> says:
"Usually the path is set to /, which means the cookie is valid throughout
the entire domain."

This is a real pain! The way my website works, I have dynamic asp
pages run from the domain root directory and static html pages run
from sub directories. In this particular case I am allowing the user
to set a cookie determining the language to use, English, German or
French and I find that my pages in the sub directories are not getting
the current language value.

Any ideas?






--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
.



Relevant Pages

  • Re: running programs from user acctount as root
    ... the package updater or any other program that requires root access from my ... will not have a copy of the current cookie. ... You can see what file contains the "magic cookie" by running ...
    (Fedora)
  • Re: FormsAuthentication.RedirectFromLoginPage
    ... creating the cookie, creating the authentication ticket stored in the cookie, ... "Andy Sutorius" wrote: ... > control access into a subdirectory from the web.config in the root folder. ... doesn't the redirectfromloginpage call create the cookie for you? ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Weird problem (groupcheck)
    ... In the directory 'root\login' is also where the cookie is created. ... from root to the lowest directory. ... > put all the groups where a user is member off in a array. ... > echo count; ...
    (php.general)
  • Re: yahoo wants to save cookies at /
    ... | that yahoo wants to dump some cookies at / (root) directory for which I have ... What makes you think konqueror is trying to save data in /? ... server requests setting a cookie with path "/", ... Proverbs 13:5 ...
    (Debian-User)
  • Cookies problem
    ... I have discovered that saved cookie only apply to pages loaded from the ... your website domain root directory then load a webpage from a directory ... versa - if you set a cookie in a webpage in a sub directory of the root then ... my pages in the sub directories are not getting the current language value. ...
    (comp.lang.javascript)