Evento refresh

JavaScript

window.onbeforeunload = function(e) {
  return 'Evento disparado!!';
};