Jump to content

on close browser


wannabe_god

Recommended Posts

is there a way to check if the user exit's the browser?onunload doesn't work, as it checks if the user leaves the page... this is the case:I have a little php script who links to itself, for the forms etc..Now I change a cookie every time to look how many times the user refreshed/filled in the form. So I want that at the end of the "session", when leaving the page to go to another/exit the browser, I want to reset the cookie...

Link to comment
Share on other sites

There has been a topic for the 'onclose' event in the past. Just to remind, there is no onclose event in html or javascript, nor the possibility to securely check for it.But in your case you can use the php 'HTTP_REFERER' to check if there has been another site viewed after the last page of your site :)It contains the last URL the user has visited.http://www.php.net/manual/nl/reserved.vari...ariables.server

Link to comment
Share on other sites

I understand what Blue means, but this method requires a new window and people may have their popup blockers on, like the standard in IE6. It could get blocked or whatever the user does if he doesn't like the new window, and the script would cease to work :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...