DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Window.onbeforeunload

04.11.2005
| 82383 views |
  • submit to reddit
        
window.onbeforeunload = function (evt) {
  var message = 'Are you sure you want to leave?';
  if (typeof evt == 'undefined') {
    evt = window.event;
  }
  if (evt) {
    evt.returnValue = message;
  }
  return message;
}
http://www.highdots.com/forums/archive/index.php/t-66363.html    

Comments

Snippets Manager replied on Fri, 2011/07/22 - 1:49am

thanks for uploading the nice stuff.... it helped me a lot... thanks...