Running dotnet 8.0.103 Nomatter how much I try to add my javascript to my index.html it does not show up in my loaded page. Using Firefox and the developer tools I don't even see it trying to be loaded. For a while it worked without any problems but now 3 days where I did not touch the project it suddenly is not loaded. ...
... I tried to move it down to where the blazor.webassembly.js script is loaded - and no changes. It is like that line is filtered out by the backend.
I found that sometimes having the line "@rendermode InteractiveServer" at the top of the page (in this case it would be JSDemo.razor) makes it so the page has interactive elements.
My demo is using blazor WASM. I assume yours is a server side app? I haven't done this with a server app, but I think as long as you put the js link in whichever file has the tag in it, I think it'll work.
Great presentation
Nice, but why all js functions start with "window.", its necessary?
It attaches the function to the browser's window object, effectively making them global.
Which ide are you using to code?
Jet brains Rider
Running dotnet 8.0.103
Nomatter how much I try to add my javascript to my index.html it does not show up in my loaded page. Using Firefox and the developer tools I don't even see it trying to be loaded.
For a while it worked without any problems but now 3 days where I did not touch the project it suddenly is not loaded.
...
...
I tried to move it down to where the blazor.webassembly.js script is loaded - and no changes.
It is like that line is filtered out by the backend.
We’ve got dotnet 8 apps running at work with js in them and haven’t had this issue, so I’m not sure what it might be.
I hope you find a fix!
I found that sometimes having the line "@rendermode InteractiveServer" at the top of the page (in this case it would be JSDemo.razor) makes it so the page has interactive elements.
i dont have index.cshtml page. I just have app.razor
My demo is using blazor WASM. I assume yours is a server side app? I haven't done this with a server app, but I think as long as you put the js link in whichever file has the tag in it, I think it'll work.