DEV Community

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

Collapse
 
kenny08gt profile image
Alan Hurtarte

Thanks! this is very helpful, I wish it had an option to make an action when the user actually agree to leave, like delete localstorage.

Collapse
 
samthor profile image
Sam Thorogood

You could do the action and revert it if your JS runs again.