Forum Moderators: open

Message Too Old, No Replies

OnUnload event

         

sekhar_jaji

10:37 am on May 12, 2008 (gmt 0)

10+ Year Member



Onunload event fires when the browser is unloaded. But this means it is fired even when the user is redirected from the page (either through submit or through a link) or when the user refreshes the page.

Is there anyway to detect that the user actually clicked on 'Close' icon on the browser?

vincevincevince

10:51 am on May 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to unset the event as soon as someone clicks a link or a submit, that way it will only fire when the browser is closed.

sekhar_jaji

11:10 am on May 12, 2008 (gmt 0)

10+ Year Member



thanks for the reply.

first issue with that approach is even when the user refreshes the page, the popup appears. (because we dont have control to remove the event)

second one is we have to call javascript functions to unset the event for each and every link or buttons which is tedious.

There must be an easy way to do this.

vincevincevince

11:19 am on May 12, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Perhaps you may wish to explain why you wish to capture this event, and we can suggest a way around it which will work.