Closed pournasserian closed 5 months ago
@babakhani the new layout implementation is depended to this
@pournasserian
I think the PageScript
component from this example is useful in this case.
https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/static-server-rendering?view=aspnetcore-8.0 https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/startup?view=aspnetcore-8.0#javascript-initializers
Blazor does not have this component by default but there is a detailed guide in documentation that addresses the issue and implements this solution.
@pournasserian I think the
PageScript
component from this example is useful in this case.https://learn.microsoft.com/en-us/aspnet/core/blazor/javascript-interoperability/static-server-rendering?view=aspnetcore-8.0 https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/startup?view=aspnetcore-8.0#javascript-initializers
Blazor does not have this component by default but there is a detailed guide in documentation that addresses the issue and implements this solution.
Correct, it says:
When using Blazor's enhanced navigation feature, which allows the user to avoid reloading the entire page, page-specific JS may not be executed again as expected each time an enhanced page navigation occurs.
And then:
To avoid this problem, we don't recommended relying on page-specific Githubissues.
Githubissues is a development platform for aggregating issues.
Assume that I have a JavaScript file in wwwroot: test.js
If I add the below tag in HTML
head
orbody
section, it won't working as expected. In SSR mode, it is fine. But, routing between interactive pages, it won't work.If we refresh an interactive page, SSR will be loaded first. So, it will work.
This is similar question: https://stackoverflow.com/questions/77541705/embed-javascript-in-the-blazor-component-in-net-8