Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

detecting the javascript refresh event

Status
Not open for further replies.

g8z

Programmer
Dec 18, 2001
12
US
How does one detect the browser refresh event?

I'm making a program that requires that the user not manully refresh the screen - if a manual refresh is done anyway, an error should appear.

Is there a different between clicking &quot;Refresh&quot; vs. typing in the same URL again to the Address Bar vs. using <meta redirect...> code to automatically refresh. And if there is a different, how would these differences be detected?
 
can't your &quot;app&quot; do the job here ? (detecting conection outs)
is your page generated by some client side script ?
is it always the same url ?
u could play with the expiremeta tag maybe...
can u explain more about why u can allow reload() ? &quot;refresh&quot;
someone knowledge ends where
someone else knowledge starts
 
I can detect a disconnection using unUnload() in the <body> tag, however, my app (a PHP/Javascript chat room) needs to be able to distinguish between refresh events, browser closures, form submissions, and even back/forward events. It would be most helpful to be able to precisely distinguish the actions using Javascript somehow.

E.g. If browser closes, then the &quot;logged in&quot; user list must update, but if the browser refreshes, then no update to the user list, but the area where the chat messages are displayed should update, etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top