You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Nenad Steric <ne...@teleweb.at> on 2001/06/19 08:56:36 UTC

Sending Cookies on Page-Reload

Hi,

i am using a Cookie which has a timeout as a "-value",
when it expires i want to send a new one which should replace this one.

it the accesshandler is have a 
"verify_cookie"-method which
checks the timeout, if it's expired then i call
...
$cookie = CGI::Cookie->new(-name => 'myCookie',... etc -Value => {'Time' => $newtime .... })
$r->headers_out->add($cookie);
...

If the user is surfing to different pages this works,
but if he just hits reload the cookie is not being set by the browser 
(Netscape seems to check the date of the file or something like that)
OR the browser gets the old cookie again - at least thats what Konqueror tells me.

Is there a way to force a browser to set a new cookie on reload?


Thanks,

Nenad

Re: Sending Cookies on Page-Reload

Posted by Nenad Steric <ne...@teleweb.at>.
Yes i tried it also with no_cache(1),
the problem (i think) is that the page has been sent already 
once without no_cache when the user hits reload.

I don't know if it would be a good idea to disable caching for all pages ..
could i just fake that the the filedate for this page has changed, so that 
only a browser which needs to refresh its cookie will really reload the page ?



Chip Turner wrote:
> 
> Do you have a $r->no_cache(1) somewhere before your send_headers call?
> 
> Chip
> 
> Nenad Steric <ne...@teleweb.at> writes:
> 
> > Hi,
> >
> > i am using a Cookie which has a timeout as a "-value",
> > when it expires i want to send a new one which should replace this one.
> >
> > it the accesshandler is have a
> > "verify_cookie"-method which
> > checks the timeout, if it's expired then i call
> > ...
> > $cookie = CGI::Cookie->new(-name => 'myCookie',... etc -Value => {'Time' => $newtime .... })
> > $r->headers_out->add($cookie);
> > ...
> >
> > If the user is surfing to different pages this works,
> > but if he just hits reload the cookie is not being set by the browser
> > (Netscape seems to check the date of the file or something like that)
> > OR the browser gets the old cookie again - at least thats what Konqueror tells me.
> >
> > Is there a way to force a browser to set a new cookie on reload?
> >
> >
> > Thanks,
> >
> > Nenad
> 
> --
> Chip Turner                   cturner@redhat.com
>                               RHN Web Engineer

Re: Sending Cookies on Page-Reload

Posted by Chip Turner <ct...@redhat.com>.
Do you have a $r->no_cache(1) somewhere before your send_headers call?

Chip

Nenad Steric <ne...@teleweb.at> writes:

> Hi,
> 
> i am using a Cookie which has a timeout as a "-value",
> when it expires i want to send a new one which should replace this one.
> 
> it the accesshandler is have a 
> "verify_cookie"-method which
> checks the timeout, if it's expired then i call
> ...
> $cookie = CGI::Cookie->new(-name => 'myCookie',... etc -Value => {'Time' => $newtime .... })
> $r->headers_out->add($cookie);
> ...
> 
> If the user is surfing to different pages this works,
> but if he just hits reload the cookie is not being set by the browser 
> (Netscape seems to check the date of the file or something like that)
> OR the browser gets the old cookie again - at least thats what Konqueror tells me.
> 
> Is there a way to force a browser to set a new cookie on reload?
> 
> 
> Thanks,
> 
> Nenad

-- 
Chip Turner                   cturner@redhat.com
                              RHN Web Engineer