Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to force Blazor page to execute script on navigation

$
0
0

What causes a script tag to be executed in a Blazor Web App?

It appears that when a page in my test app is navigated to with the the URL or refreshed using the browser my "test.js" script runs which adds a "style" element to "head" which changes the background to green. However, if I click on the "Home" link (or "Counter", or "Weather") from the left navigation pane, the "style" tag is removed from "head", which means the "test.js" script did not run.

How do I force the script to re-run each time the page is navigated to using the links on the left?

On app load (or refresh, or nav using a URL):On app load (or refresh, or nav using a  URL

After navigating to the link "Home" using the left pane navigation:After navigating to the link "Home" using the left pane navigation


Viewing all articles
Browse latest Browse all 4839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>