6 Replies Latest reply: Apr 28, 2014 7:40 AM by Hippy Steve RSS

    modal popup & onbeforeunload...

    Hippy Steve

      I'm using the SkillBuilders modal popup plugin, excellent piece of kit.  Now I want to stop users from closing the modal page without clicking the close button.

       

      I've put in the bog-standard jscript function to the onbeforeunload which works perfectly when I show the page in stand-alone mode.  But when I show it as a modal popup then the window closes before the confirm message appears...  I've tried numerous variations, even the script below which fires however you move away from the page, when the page is a popup then it disappears before the confirm dialogue displays, simply returning to the parent page.

       

      Anybody else seen this?  How did you get round it?  Is it something I've missed on the setup of the modal page?

       

         <script type="text/javascript">

               window.onbeforeunload = function(){ return 'are you sure you wanted to do that?';}

          </script>