Cookie Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bonehead

    Cookie Question

    Greetings,

    Is it possible to set a cookie to die if the user leaves my site *within
    the current session*? I'm pretty sure the answer is "no", I just need
    some confirmation.

    Of course, if the answer is "yes", any pointers to documentation will be
    gratefully accepted.
  • neur0maniak

    #2
    Re: Cookie Question

    A session cookie will die after the browser is closed if you specify no
    expiry date for the cookie.

    If you use setcookie("name ", "var"); then the cookie will only be
    available while the browser is open.


    bonehead wrote:[color=blue]
    > Greetings,
    >
    > Is it possible to set a cookie to die if the user leaves my site *within
    > the current session*? I'm pretty sure the answer is "no", I just need
    > some confirmation.
    >
    > Of course, if the answer is "yes", any pointers to documentation will be
    > gratefully accepted.[/color]

    Comment

    • bonehead

      #3
      Re: Cookie Question

      neur0maniak wrote:
      [color=blue]
      > A session cookie will die after the browser is closed if you specify no
      > expiry date for the cookie.
      >
      > If you use setcookie("name ", "var"); then the cookie will only be
      > available while the browser is open.[/color]

      Thanks. I had this part already figured out. To reiterate,
      [color=blue][color=green]
      >> Is it possible to set a cookie to die if the user leaves my site
      >> *within the current session*?[/color][/color]

      Comment

      • neur0maniak

        #4
        Re: Cookie Question

        I'd guess that would have to involve a hidden frame, and some onUnload
        javascript code...



        bonehead wrote:[color=blue]
        > neur0maniak wrote:
        >[color=green]
        >> A session cookie will die after the browser is closed if you specify
        >> no expiry date for the cookie.
        >>
        >> If you use setcookie("name ", "var"); then the cookie will only be
        >> available while the browser is open.[/color]
        >
        >
        > Thanks. I had this part already figured out. To reiterate,
        >[color=green][color=darkred]
        >>> Is it possible to set a cookie to die if the user leaves my site
        >>> *within the current session*?[/color][/color][/color]

        Comment

        • Tony Marston

          #5
          Re: Cookie Question


          "bonehead" <sendmenospam@n owhere.invalid> wrote in message
          news:clbnf3$hur $1@gondor.sdsu. edu...[color=blue]
          > neur0maniak wrote:
          >[color=green]
          >> A session cookie will die after the browser is closed if you specify no
          >> expiry date for the cookie.
          >>
          >> If you use setcookie("name ", "var"); then the cookie will only be
          >> available while the browser is open.[/color]
          >
          > Thanks. I had this part already figured out. To reiterate,
          >[color=green][color=darkred]
          >>> Is it possible to set a cookie to die if the user leaves my site *within
          >>> the current session*?[/color][/color][/color]

          It is not possible to know when the user stops visiting your site as only
          visits (i.e. HTTP requests) are actually sent to the web server. If someone
          opens up a page on your site then jumps to another site this jump is a
          request to the second site and nothing is sent to you.

          This is not a PHP problem, it is an HTTP problem.

          --
          Tony Marston

          This is Tony Marston's web site, containing personal information plus pages devoted to the Uniface 4GL development language, XML and XSL, PHP and MySQL, and a bit of COBOL




          Comment

          Working...