pbsthlm
04-15-2004, 03:45 AM
Hi there,
I'm trying to execute an onUnload when closing my browser. I have managed to get it to work except for when i click on an empty area in the browser window. For some reason this disables the onUnload. I'm capturing the clicks and it works for clicking a link but not if you click on "nothing".
This is the code;
<SCRIPT LANGUAGE="JavaScript">
<!--
var surfa=false;
var PopUrl='www.microsoft.com';
function Klicka(){
surfa=true;
}
function Oppna(){
if (surfa==false){
open(PopUrl,'','');
}
}
if (!document.all){
window.captureEvents(CLICK);
window.onunload=Oppna;
window.onclick=Klicka;
}
else {
document.onclick = Klicka;
window.onunload=Oppna;
}
//-->
</SCRIPT>
Is it possible to execute the onUnload even after having clicked an empty area in the browser?
I'm trying to execute an onUnload when closing my browser. I have managed to get it to work except for when i click on an empty area in the browser window. For some reason this disables the onUnload. I'm capturing the clicks and it works for clicking a link but not if you click on "nothing".
This is the code;
<SCRIPT LANGUAGE="JavaScript">
<!--
var surfa=false;
var PopUrl='www.microsoft.com';
function Klicka(){
surfa=true;
}
function Oppna(){
if (surfa==false){
open(PopUrl,'','');
}
}
if (!document.all){
window.captureEvents(CLICK);
window.onunload=Oppna;
window.onclick=Klicka;
}
else {
document.onclick = Klicka;
window.onunload=Oppna;
}
//-->
</SCRIPT>
Is it possible to execute the onUnload even after having clicked an empty area in the browser?