Rate this script:  I Love it  /   I Hate it

window.onbeforeunload


Code


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;
}
 

 

 
window.onbeforeunload scripts | window.onbeforeunload snippet | window.onbeforeunload example | window.onbeforeunload tutorial | window.onbeforeunload code