"The onLoad and onUnload events are triggered when the user enters or leaves the page." -- w3schools
A refresh is leaving a page and then entering the same once again. I don't think there is a way to see if the same page will be loading again, or if the browser is closing.
onbeforeunload only appears to be working in IE en FF.
pritaeas
Posting Expert
5,480 posts since Jul 2006
Reputation Points: 653
Solved Threads: 875
If a browser reloads a new HTTP request is sent. So what you can do is wait a few seconds for the next HTTP Request.
eg:
On the PHP page that updates the DB do a
sleep(15);
This way the script waits for 15 secs. Then check if the user session has been updated after the script went to sleep. If so, then a new request was made.
You could probably take that down to 10 or even 5 secs.
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101