I have tried below code for mentioned purpose but this is not working in mozila and also i am getting some extra line in confirmation box.
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> <title>Coordinates!</title>
<script type="text/javascript">
var myclose = false;
function ConfirmClose()
{
if (event.clientY < 0)
{
event.returnValue = 'Any message you want';
setTimeout('myclose=false',100);
myclose=true;
}
}
function HandleOnClose()
{
if (myclose==true)
alert("Window is closed");
}
</script>
</head> <body onbeforeunload="ConfirmClose()" onunload="HandleOnClose()" ><a href="#">test</a> </body></html>
could you please suggest something for mozila.
You can achieve the same using jQuery.
Check this example. Type something in textbox close window.
If you are trying to display a pop up when the user tries to navigate away from the page it is possible and there is even a cross browser solution. But if, what you are trying to do is making a call from javascript to see if firefox is exiting, I dont think that is possible from javascript...then again I might be wrong.
source