in reply to javascript.. perl.. cookie

Hmmm. Fairly good question why it's not working for you. I tried your javascript and it worked in both Mozilla and IE. The only reason I can think of for the cookie's refusal to show is that the page that contains the javascript is under a path different from the perl script. When I changed the path of the html page from that of the script, it did fail. The obvious solution is to set the path to the deepest common path. Of course, this may simply be '/'.

Hope this helps.

antirice    
The first rule of Perl club is - use Perl
The
ith rule of Perl club is - follow rule i - 1 for i > 1

Replies are listed 'Best First'.
Re: Re: javascript.. perl.. cookie
by wolverina (Beadle) on Nov 01, 2003 at 00:29 UTC
    are you saying you were able to get the perl script to read the javascript cookie? -Lisa

      Yes, I was able to get the perl script to read the javascript cookie. However, the path had to be set when the perl script and the html page didn't have the same path. If you don't specify the path when the cookie is set by javascript, the current path is used. Since you didn't set it (SetCookie takes up to five params yet you only provide three, the fourth would be the path) it uses the current path. If the path of the perl script isn't below said path, the browser will not send the cookie.

      For illustrative purposes:

      These work: HTML at: http://www.blah.com/page.html Perl script at: http://www.blah.com/cookie.pl HTML at: http://www.blah.com/page.html Perl script at: http://www.blah.com/cgi-bin/cookie.pl This doesn't work: HTML at: http://www.blah.com/content/page.html Perl script at: http://www.blah.com/cookie.pl

      Of course if the perl script is generating the html content, the cookie should be picked up the next time you visit the script.

      Hope this helps.

      antirice    
      The first rule of Perl club is - use Perl
      The
      ith rule of Perl club is - follow rule i - 1 for i > 1

        Thanx... helps a lot.. i'll give it a try. I did open the cookie and changed the path, then saved the cookie, but to no avail.. guess it's a cookie thing. woof. Lisa.