How to Execute a Method in Completing the Section?

Asked

Viewed 25 times

0

I need to execute a certain method when the section is closed (when the user clicks to close the browser). I’m working with JSP and I don’t know how I can do it.

1 answer

0

You can try some things using Javascript and/or Jquery:

First way:

You can use Jquery Unload: http://api.jquery.com/unload/

Second way:

Using a bind with javascript:

$(window).bind('beforeunload', function() {
 alert("fechei");

});

Additional:

Experience the following functions:

window.onbeforeunload = function(){alert("oi");}
window.addEventListener("beforeunload", function(e){alert("oi");}, false);

I hope I’ve helped.

Att

Browser other questions tagged

You are not signed in. Login or sign up in order to post.