HTML5 History API for Blazor without any JavaScript Library Dependency.
This package wraps HTML5 History APIs.
Install-Package BlazorHistory -Version 1.0.0
services.AddBlazorHistoryService();
This library has no javascript library reference dependency.
[Inject] IBlazorHistoryService BlazorHistory { get; set; }
BlazorHistoryService | Method |
---|---|
Goes to the previous page in session history | Back() |
Goes to the next page in session history | Forward() |
Loads a page from the session history by index | Go(int index) |
Pushes the given data onto the session history stack | PushState(T stateData, string pageTitle, string url) |
Updates the most recent entry on the history stack | ReplaceState(T stateData, string pageTitle, string url) |
Returns an Integer representing the number of elements in the session history, including the currently loaded page | Length() |
Allows web applications to explicitly set default scroll restoration behavior on history navigation. This property can be either auto or manual. | ScrollRestoration(ScrollRestorationType scrollRestorationType) |
Allows web applications to explicitly get default scroll restoration behavior on history navigation. This property can be either auto or manual. | ScrollRestoration() |
Returns a T type representing the state at the top of the history stack | State() |
MIT