DEV Community

Discussion on: Sure you want to leave?—browser beforeunload event

 
yerycs profile image
yerycs

Let us assume.

I have passed complex page which has decades tests.
After passing this page, I get into the test result page.

If I click back button without any interaction in browser, then it goes to test page without confirmation, and I lost test result and should pass complex test again.

I hope it can be resolved.
Any Idea?

Thread Thread
 
samthor profile image
Sam Thorogood

Yes, that will go "back", but there are lots of other ways to store state (like your test results) that don't rely on the user keeping a page open.

e.g., indexdb, local storage, building a SPA where 'back' is handled by your code, etc ...

Thread Thread
 
yerycs profile image
yerycs

Understand.

Thanks for your kindly help.
Hoping your good post. :)