onUnload()

N

Nadim Attari

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
 
R

Richard Cornford

Nadim said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top