Once you've installed this NuGet package to your Blazor application,
dotnet add package Toolbelt.Blazor.GetProperty.Script
you can use the Toolbelt.Blazor.getProperty
global JavaScript function in your Blazor application. The Toolbelt.Blazor.getProperty
allows you to retrieve any global property values specified by dot-separated property path string without any additional installations and configurations, like below.
@inject IJSRuntime JSRuntime
@code
{
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
var onLine = await JSRuntime.InvokeAsync<bool>("Toolbelt.Blazor.getProperty", "navigator.onLine");
}
}
}