This code will help you to understand how to check whether the current app is Blazor server-side or web assembly.
You can check whether the current app is Blazor server-side or web assembly using the “IJSInProcessRuntime” interface. In the following example, I have checked whether the app is a web assembly or server-side on button click.
<button @onclick="@onClick"> Click </button> @code { [Inject] protected IJSRuntime jsRuntime { get; set; } private void onClick() { var isWebAssembly = this.jsRuntime is IJSInProcessRuntime; } }
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
You can check whether the current app is Blazor server-side or web assembly using the “IJSInProcessRuntime” interface. In the following example, I have checked whether the app is a web assembly or server-side on button click.
need an explanation for this answer? contact us directly to get an explanation for this answer