Click here to Skip to main content
15,891,993 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Experts,

I have a model poup.. And i need to show my modelpoup in the browser or Tab close event...

Can i show my modal poup in browser close event using Javascript .?


Thanks and Regards,

Dileep
Posted

Use the window.onbeforeunload; for instance,
JavaScript
<script>
    window.onbeforeunload = function(e) {
      return 'Are you sure you want to leave this page?  You will lose any unsaved data.';
    };
</script></script>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900