mirror of
				https://github.com/avatao-content/frontend-tutorial-framework
				synced 2025-11-04 06:12:54 +00:00 
			
		
		
		
	Add 'are you sure?' style accidental page refresh prevention
This commit is contained in:
		@@ -17,5 +17,10 @@ export class AppComponent implements OnInit {
 | 
			
		||||
 | 
			
		||||
  ngOnInit() {
 | 
			
		||||
    this.titleService.setTitle(this.documentTitle);
 | 
			
		||||
    window.addEventListener('beforeunload', (event) => {
 | 
			
		||||
      const confirmationMessage = 'Refreshing this page may mess up your challenge/tutorial state. Are you sure?';
 | 
			
		||||
      event.returnValue = confirmationMessage;
 | 
			
		||||
      return confirmationMessage;
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user