mirror of
https://github.com/avatao-content/frontend-tutorial-framework
synced 2024-12-05 02:11:32 +00:00
Add 'are you sure?' style accidental page refresh prevention
This commit is contained in:
parent
7fea6e2029
commit
58cc7d1889
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user