Posted By

saturngod on 03/10/10


Tagged

confirm unload


Versions (?)

Ask confirm on leave


 / Published in: JavaScript
 

  1. needToConfirm = false;
  2. window.onbeforeunload = askConfirm;
  3.  
  4. function askConfirm(){
  5. if (needToConfirm){
  6. return "You have unsaved changes.";
  7. }
  8. }

Report this snippet  

You need to login to post a comment.