javascript prompt on window close

Solutions on MaxInterview for javascript prompt on window close by the best coders in the world

showing results for - "javascript prompt on window close"
Lukas
18 Jun 2018
1// custom message prompt is no more supported (only IE does)
2window.addEventListener("beforeunload", function(e) {
3	if( someBusyFlag )
4    {
5  		// ask for stay
6		e.preventDefault();
7      	// Chrome requires this var set
8      	e.returnValue = '';
9    }
10	else
11    {
12    	// grant quit
13      	delete e['returnValue'];
14    }
15});