mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2025-06-28 12:05:11 +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() {
|
ngOnInit() {
|
||||||
this.titleService.setTitle(this.documentTitle);
|
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