wannabe_god Posted June 11, 2006 Share Posted June 11, 2006 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 More sharing options...
Jack McKalling Posted June 12, 2006 Share Posted June 12, 2006 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 More sharing options...
Webworldx Posted June 12, 2006 Share Posted June 12, 2006 What aboutonunload >> open small new window >> check if window.opener still exists? Link to comment Share on other sites More sharing options...
aspnetguy Posted June 12, 2006 Share Posted June 12, 2006 What aboutonunload >> open small new window >> check if window.opener still exists?<{POST_SNAPBACK}> I have been unsuccessful in getting this method to work. Do you have an example? Link to comment Share on other sites More sharing options...
Jack McKalling Posted June 13, 2006 Share Posted June 13, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now