Hi friends
I have an web application, when a user exit using the [ X ] on the top right of the browser. I want to open a conformation box equring abt the descion of the user.
The main problem is my function is not 100% sure if a user has realy exited , or is doing something else, eg : 'refersh' its the ambugity.
I am lokking for something which is 100% sure .
Currently I am doing with javascript on page un load , the problem is the event is not being caputuerd on the client side on the broser , even though I am able to capute it on unload on the server, the function fires on even page refresh and when when ever a user manualy changes the address in the browser address manualy. Though I have filterd the events fired by input,image and A tags tha app is not 100% perfect.
heres the code
on unload:
onunload=con
Javascript:
var SopingMode_clicked = false; // to be made true if the checking condition is met by the app.
document.onclick = function(e)
{ alert("hi");
var nn6=document.getElementById&&!document.all;
var SopingMode_e = (nn6==true) ? e.target : event.srcElement;
alert(SopingMode_e.tagName+"event");
if(SopingMode_e.tagName == "A" || SopingMode_e.tagName == "INPUT" || SopingMode_e.tagName == "IMG")
{ SopingMode_clicked=true;}
}
var win=window;
var exit=true;
function con()
{
(window.closed+"W "+win.closed+"W "+window.close+"-"+window+" e "+exit+"e ");
if(ShopingMode_InCart)
{
if (exit)//if(window.closed)
{
if(SopingMode_clicked)
{
}
else
{
if(confirm("There are items in the shopping acrt are you sure you want to exit !"))
{
}
else
{
var der=document.URL;
window.open(der,'navtej',"");
}
}
}
}
}
the code is working fine the prolem is with ambugity.
Thanks.




Bookmarks