Blazor WebAssembly Get IP Address

You can use a third party API, such as Ipify, to get the IP address of the current request in Blazor. The script api.ipify will return the IP address in JSON format. But this is a workaround. As of now, there is no way to achieve this. In the following code snippet, the IP address... » read more

JavaScript and Blazor without index.html reference

JavaScript Isolation in Blazor WebAssembly From the .NET 5 (RC 1) version, we are able to isolate our JavaScript code as a standard JavaScript module. This is beneficial because We no longer have to add our JS functions to the global window namespace We don’t have to manually import JavaScript files in the index.html file myscript.js Razor... » read more

PWA and Caching

Control asset caching If your project defines the ServiceWorkerAssetsManifest MSBuild property, Blazor’s build tooling generates a service worker assets manifest with the specified name. The default PWA template produces a project file containing the following property:XMLKopiëren The file is placed in the wwwroot output directory, so the browser can retrieve this file by requesting /service-worker-assets.js. To see the contents of... » read more

Forcing reload of Blazor client after publishing changes

Since your app is a PWA, you can declare a js file for registration in the navigator.serviceWorker object. This my.js file can contain a const CACHE_VERSION = 1.0. Updating this value should force the client to download the latest files. See Jeremy Likness’ blog post for more info. Example: service-worker.published.js Note: The original one does not work. Replace self.assetsManifest.version... » read more

Pass data from child to parent component in blazor

Child component to parent component communication The parent component assigns a callback method to the child component’s event. In Blazor, to expose an event we use EventCallback. Sources: https://www.pragimtech.com/blog/blazor/pass-data-from-child-to-parent-component-in-blazor/

Blazor Component: Pass value from child to parent

To pass values from a child to a parent component, see the following. Parent component Child component Sources: https://www.syncfusion.com/faq/blazor/components/how-do-you-pass-values-from-child-to-parent-using-eventcallback-in-blazor https://docs.microsoft.com/en-us/aspnet/core/blazor/components/data-binding?view=aspnetcore-5.0#child-to-parent-binding-with-chained-bind