Home > Blockchain >  Is it possible to catch the history.back event before navigating?
Is it possible to catch the history.back event before navigating?

Time:12-09

I would like to query whether the IsDirty flag is true or false when I click on the back button, but it should be before and not when the navigation is already finished. I'm not sure if this is so easy or if it's a bit more complex.

CodePudding user response:

There is no "Simple" answer to this problem. While you can use various strategies within page and navigation menus to restrict dirty form exits, there are no easy one-liner ways to control browser navigation requests.

My current solution to this problem, which addresses all normal form exit mechanisms can be found here Blazr.Demo.Routing.

It rebuilds Router, adds a new Navigation Manager and interfaces with the browser beforeunload event.

  • Related