Controlling navigation history
The NavigationManager
in Blazor uses the browser’s History API to maintain navigation history. Manipulating navigation history is particularly useful when authenticating users with external identity providers, where users are redirected back to an application after authentication. It’s also beneficial when displaying intermediate pages that allow users to configure their application, but you want to restrict them from going backward in that process.
Let’s simulate intermediate page removal from the browser history and force users to navigate to the last stable page when they try to return to the intermediate stage.
Getting ready
Before we explore browser navigation history manipulations, do the following:
- Create a
Chapter09
/Recipe08
directory – this will be your working directory - Copy the
ExternalEventManager
andDeepLinks
files from the Canceling a long running task when users navigate away recipe or the...