Add 'are you sure?' style accidental page refresh prevention

This commit is contained in:
Kristóf Tóth 2018-05-28 13:35:25 +02:00
parent 7fea6e2029
commit 58cc7d1889

View File

@ -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;
});
}
}