I want to trigger my bootstrap modal when user tries to close the browser. I am trying to do it with below code but doesn't seem to be working.
window.onbeforeunload = function(e){
$('#myModal').modal('show');
}
If it is not possible then how can I trigger it on closing or clicking the back browser button? Any help would be appreciated.