If I understand your code correctly, you're trying to tell the user's browser that it should delete the cookies. Of course, the user's browser is free to take your advice and delete them, or it could ignore you and keep them until the end of time. You can tell the browser to delete them as a courtesy, so that a well-behaved browser does not need to continue to store them, but you also should invalidate or delete the cookies on the server side, so that if the browser should happen to continue to present them they will be ignored.

I realise this doesn't answer your question, because what you really want to know is whether there's a problem with your code that's causing the browser to fail to understand what you're telling it. However, I don't really know. I am personally unfamiliar with the "Delete cookies" header. According to this (fairly old) document at Netscape, the way to delete a cookie is to re-issue it with the same name, but with an expiration date in the past. This is probably the oldest way to delete a cookie and so therefore probably has the widest browser support, and it seems to be what you are doing (on the line right before the "Delete Cookies" line). That should work in most browsers, but you may have to wait for the browser to be closed and restarted before it will take effect. Also, if the browser in question has a run-continuously-in-the-background feature, "closed and restarted" may mean the computer may need to be rebooted, though I'm not certain about that. As far as the "Delete Cookies" header, I don't know what browsers (if any) support it. Or is that just information for you or the user to know what's going on?

update: I just noticed that you are trying to do them all in one fell swoop by using join to lump the cookies all together into one. That may not work. You may need to expire each one separately by calling CGI::Cookie->new once for each cookie. Beyond that, I don't know.


$;=sub{$/};@;=map{my($a,$b)=($_,$;);$;=sub{$a.$b->()}} split//,".rekcah lreP rehtona tsuJ";$\=$ ;->();print$/

In reply to Re: Problem to delete a cookie by jonadab
in thread Problem to delete a cookie by webstudioro

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.