0

I want to display a twitter bootstrap modal when the user clicks the back,forward or refresh browser button,but I am not getting the desired o/p.This is what I tried :

    @section Scripts{
    <script type="text/javascript">
        function myFunction() {
            return $('#cancel_modal').modal('show');
        }
    </script>
}

and called it in the body :

<body onbeforeunload="return myFunction()">

Note: #cancel_modal is the id of the <div> where bootstrap modal is defined.

Sumedha Vangury
  • 643
  • 2
  • 17
  • 43

1 Answers1

2

I don't think this is possible. Please see this SO question for more information. Dialog box runs for 1 sec and disappears?

Nithish Thomas
  • 1,515
  • 14
  • 20