onUnload

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
moiseszaragoza
Forum Commoner
Posts: 87
Joined: Sun Oct 03, 2004 4:04 pm
Location: Ft lauderdale
Contact:

onUnload

Post 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
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
User avatar
moiseszaragoza
Forum Commoner
Posts: 87
Joined: Sun Oct 03, 2004 4:04 pm
Location: Ft lauderdale
Contact:

Post 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>
Post Reply