View Full Version : on close
03-12-2007, 10:15 PM
In php is there a method for that can be used when a user closes the browser?
I want to set a variable when the user closes the window
03-12-2007, 10:28 PM
03-12-2007, 10:30 PM
No. PHP runs on the server, not the client. Your variable has no meaning by the time the client is using the page (unless it's session or application scope).
Web applications are best coded with the stateless nature of http in mind. Do your cleanup on session timeout, if you can, or code cleanup periodically in a stateless manner.
Amazon has some great examples of how they handle things like stuff left in the shopping cart and whatnot.
03-12-2007, 10:33 PM
thanks for that!
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.