window.onbeforeunload = confirmExit; function confirmExit(){ if (typeof executingPostBack == 'undefined') return ""; }