-
-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent "back button" navigation #452
Comments
You can try creating a custom hook that wraps default https://codesandbox.io/s/wouter-demo-interruptible-transition-v3-phrcz4?file=/src/index.js |
Thanks for your reply, but the provided link is not loading :( |
Hmm... I changed the sandbox visibility, could you try again? |
Thankyou. Ok I tried the sandbox and it doesn't seem to address my issue. I followed these steps:
|
Back button won't go through the react-router seems to handle back/forward by immediately undoing the navigation via |
I'm developing an app where I need to prevent "back button" in some cases, (e.g.: when I'm editing a form and I click back button I should receive a confirmation dialog before the navigation occurs).
I tried adding the well known
beforeunload
event. But it only works when the navigation was not made viapushState
/setLocation
.Is it possible to achieve the behavior I need with wouter?
The text was updated successfully, but these errors were encountered: