Nadim Attari wrote:
how can i know whether the surfer is closing the window (web browser)
or he is moving from one page to another (e.g. by clicking a link or
submitting a form...) ?
You can know if a user is navigating as a result of clicking a link or
submitting a form on *your* page, by installing code on your pages that
monitors such activity. Other activity; choosing a favourite/bookmark,
typing a URL into the location bar, using any 'history' facility, back
or forward buttons, dragging a web link onto the browser window, etc are
not exposed to javascript and cannot be detected. So there is no way of
knowing whether an onunload event is being triggered as a result of the
user closing the browser or some other activity outside of the scope of
a web page.
Richard.