javascript prompt on window close
// custom message prompt is no more supported (only IE does)
window.addEventListener("beforeunload", function(e) {
if( someBusyFlag )
{
// ask for stay
e.preventDefault();
// Chrome requires this var set
e.returnValue = '';
}
else
{
// grant quit
delete e['returnValue'];
}
});