471,119 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 software developers and data experts.

onUnload()

Hi,

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...) ?

thanks,
nadim attari
Jul 23 '05 #1
1 1169
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.
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.