Detecting and Confirming browser window close/navigation events

onunload event didnt quite work in mozilla or internet explorer

another event called onbeforeunload gives a better desired effect

window.onbeforeunload = function unloadEvent()
{
   return ("Are you sure you want to navigate away from the page.");
}

or still better

window.onbeforeunload = function unloadEvent()
{
   return ("");
}

for just a confirmation.
This event is available on Mozilla and Internet Explorer but probably not on Opera

Popularity: 1% [?]

One Response to “Detecting and Confirming browser window close/navigation events”

  1. A test page for opera users to confirm that the function is available or not ?

Leave a Reply