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