How to execute a method at the end of the section? [duplicate]

0

I need to execute a certain method when the section is closed (when the user clicks close the browser). I'm working with JSP and I'm not sure how I can do this.

    
asked by anonymous 22.02.2016 / 12:37

1 answer

0

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

First mode:

You can use Jquery unload: link

Second mode:

Using a bind with javascript:

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

});

Additional:

Try the following functions:

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

I hope I have helped.

Att

    
22.02.2016 / 14:05