Could not find 'BlazorExtensions' in 'window' (Server mode)
See original GitHub issueIn a new project, using server side template, I added the reference to BlazorExtensions storage (0.2.1), added the services.AddStorage() line to register the services. If I modify the counter example to this:
`@page “/counter” @using Blazor.Extensions.Storage @inject SessionStorage sessionStorage @inject LocalStorage localStorage
Counter
Current count: @currentCount
<button class=“btn btn-primary” @onclick=“IncrementCount”>Click me</button>
@code { int currentCount = 0;
async void IncrementCount()
{
currentCount=await localStorage.GetItem<int>("counter");
currentCount++;
localStorage.SetItem("counter", currentCount).Wait();
}
} ` I receive the error Could not find ‘BlazorExtensions’ in ‘window’. blazor.server.js is present in Sources when I enter in dev mode in chrome. dotnet --version outputs 3.0.100-preview7-012821.
Is that correct?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:17 (1 by maintainers)
Top Results From Across the Web
blazor - Could not find 'BlazorInputFile' in 'window'
If that doesn't work, I have a Nuget project with a working sample project that uses a wrapper to Steve Sanderson Blazor File...
Read more >Persist values by user - Radzen IDE (Blazor server-side)
Learn how to persist state in Blazor Server apps. ... Could not find 'BlazorExtensions' in 'window' (Server mode).
Read more >Could not find 'windowMinWidthMatchesQuery' in 'window'
Hello,. I created a sample project using the mentioned template (DevExpress Blazor Server Application), but I did not manage to reproduce the ...
Read more >Useful Visual Studio Extensions for Working with Blazor
Client software using Blazor VSCode Extensions executes C# code directly in a browser using WebAssembly. This is possible because Blazor itself ...
Read more >Blazor WebAssembly 3.2.0 now available - .NET Blog
I'm thrilled to announce that Blazor WebAssembly is now officially released. This is a fully-featured and supported release of Blazor ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Add this to your
index.html
or_Host.cshtml
whichever you are using:<script type="text/javascript" src="_content/Blazor.Extensions.Storage.JS"></script>
Should the
blazor.extensions.storage.js
file not get automatically generated clone this github repo and build the solution. You should then find the compiled js there inside the dist folder, then just copy it over to your project in/bin/Debug/netstandardx.x/dist/_content/
If i compile the .ts scripts, put in wwwroot and init the script directly in _host.cshtml it works, so I think is related to https://github.com/BlazorExtensions/Storage/issues/24