<script type="text/javascript"> var domain='http://www.mwebng.net'; // Set your domain here. window.onbeforeunload = function() { if(this.location.href.indexOf(domain)==-1) { return "Are you sure you want to exit?"; } } </script>
This is a very simple way to prevent a browser window from closing. Facebook and some other self-respecting websites make use of this kind of technique to prevent the browser window from closing, if say you fill a form and did not save it before attempting to leave the browser window.