Jump to content


Photo

Delete a cookie when page closes - how?


  • Please log in to reply
4 replies to this topic

#1 Revos

Revos
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 31 August 2006 - 06:28 PM

How can I delete a cookie when I close page or change address?
example I got page named X, when I close that page or change address to anyother I want to delete cookie name Y, how?

#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 31 August 2006 - 06:34 PM

From PHP.net

setcookie ( string name [, string value [, int expire [, string path [, string domain [, bool secure [, bool httponly]]]]]] )
expire- If not set, the cookie will expire at the end of the session (when the browser closes).

See more at setcookie()

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 Revos

Revos
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 31 August 2006 - 06:51 PM

I have a problem:
I got page name X and it creates a cookie and opens page named Y
in page Y I check it cookie exists.
now if I dont put expire it deletes the cookie when I close page X and open page Y.
I want to create a cookie in page X(I know how)
I want to delete a cookie when I close page Y(how?)

#4 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 31 August 2006 - 07:05 PM

Use sessions if u want it to finish when the browser closes
Tell me the problem, I will try tell you the solution

#5 Revos

Revos
  • Members
  • PipPip
  • Member
  • 22 posts

Posted 31 August 2006 - 07:10 PM

Tried it already...
listen I got 2 pages, with page 1 I create a cookie\session.
With page 2 I will check if the cookie\session exists.
I want to create a cookie\session with page1 and close page1 and open page2, with page2 to check if cookie\session exists then show example.."blabla" and when I will close page2 the cookie\session will be deleted...is it possible?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users