Hello:
Can anybody tell me how to detect browser close event in Javascript and how
to call a servlet on a Brower close?
I tried some thing:
<html>
<SCRIPT LANGUAGE="JavaS cript1.2" TYPE="text/javascript">
function unloadMess(){
mess = "message."
return mess;
}
function setBunload(on){
window.onbefore unload = (on) ? unloadMess : null;
location.href=" http://localhost/servlet/ServletPrueba";
}
setBunload(true );
</SCRIPT>
<BODY>
<a href="http://www.microsoft.c om" onClick="setBun load(true)">Lin k 1</a>
<br>
<a href="http://localhost:8080/Version3/pagina2.html"
onClick="setBun load(false)">Li nk 2l</a>
</BODY>
</html>
But, I want call the servlet only when close browser or I browse to another
web.
Thanks.
Can anybody tell me how to detect browser close event in Javascript and how
to call a servlet on a Brower close?
I tried some thing:
<html>
<SCRIPT LANGUAGE="JavaS cript1.2" TYPE="text/javascript">
function unloadMess(){
mess = "message."
return mess;
}
function setBunload(on){
window.onbefore unload = (on) ? unloadMess : null;
location.href=" http://localhost/servlet/ServletPrueba";
}
setBunload(true );
</SCRIPT>
<BODY>
<a href="http://www.microsoft.c om" onClick="setBun load(true)">Lin k 1</a>
<br>
<a href="http://localhost:8080/Version3/pagina2.html"
onClick="setBun load(false)">Li nk 2l</a>
</BODY>
</html>
But, I want call the servlet only when close browser or I browse to another
web.
Thanks.
Comment