js when you leave
snippet in javascript

js when you leave

user5944

window.onbeforeunload = function(){
  return 'Are you sure you want to leave?';
};