Description
Background and Motivation
As I can see there are 3 cases with hash:
a. Navigate to a hash on a different page. That was addressed in #8393
b. Blazor uses hash for page navigation. That is #6175 .
c. Navigate to a hash on the current page.
This request is to address the latter.
As I can see there are 3 behaviors that a developer might want:
- Let the browser deal with it.
- DOM event listener for
popstate
orhashchange
and handle navigation event via javascript. - SSR (current)
The current behavior for blazor.web.js
is pretty broken IMHO: Blazor makes a full intercept and a full SSR and then uses the feature from #8393 to navigate to the element.
From the point of view of Blazor 1 and 2 are identical in the fact that if Blazor does nothing, that is the default browser behavior.
Proposed API
Add ignoreHashNavigationOnSamePage
to SsrStartOptions
.
Alternatively, respect <meta name="ignoreHashNavigationOnSamePage" />
(or something similar), so the individual page can handle it through <HeadContent>
.
Alternatively, my preferred behavior: make it the default (It makes no sense to do a SSR on same-page hash change).
Risks
There might be someone somewhere that actually reads url hash server-side.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status