1

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.

Kartikeya Khosla
  • 18,495
  • 8
  • 42
  • 66
TechieViking
  • 116
  • 1
  • 10

0 Answers0