Page 1 of 1
onUnload
Posted: Tue Feb 06, 2007 11:43 am
by moiseszaragoza
I was wandering if there are any subset events for onUnload?
I mean what happends during onUnload.
and if i can call a function at a paricular point of the onUnload process
Thanks
Posted: Tue Feb 06, 2007 2:52 pm
by Chris Corbyn
onunload is pretty much unreliable these days because it was so badly abused in the 90s and early "naughties". There's an onbeforeunload which fires just as the X is clicked and before the UnloadEvent fires. One thing you will definitely not be able to do is to open a window, or cancel the close operation with onunload. onbeforeunload can successfully be used to make a confirmation dialog that the user wishes to close the window, but again, no new windows can be made.
Posted: Tue Feb 06, 2007 3:00 pm
by moiseszaragoza
Thanks for your help
what i am tring to do is find out were the people are going when they leve the site
so i have
Code: Select all
<body onbeforeunload="onbeforeunload()" onUnload="onUnload()">
onbeforeunload hapends before unload I'm trying to get the verry last thing posible
Code: Select all
<script type="text/javascript">
function onbeforeunload(){
alert(document.location); //gives me my site (I want were they are going)
}
function onUnload(){
alert(document.location);//gives me my site (I want were they are going)
}
</script>