Answers for "javascript prompt on window close"

0

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'];
    }
});
Posted by: Guest on April-06-2021

Code answers related to "javascript prompt on window close"

Code answers related to "Javascript"

Browse Popular Code Answers by Language