How To Detect Unsupported Browsers Under a Blazor WebAssembly Application?
I recently ran into an issue where running a Blazor WebAssembly application under unsupported browsers would simply get stuck on the loading page. Whereas older browsers are supported under the “Server Side” model, it would be a much better experience to present the user with a more meaningful indicator that the browser is not supported when running “Blazor WebAssembly” model. Currently, when running Blazor WebAssembly under older browsers you get a loading indicator that never materializes to a page.
This post chronicles my journey while attempting to uncover a viable solution. The source code is hosted on my Github repository which can be found here. You can test an instance of the running solution which is hosted as a Github page here.
Understanding The Bootstrap Process
In order to understand the solution its imperative that we take a step back and understand how the Blazor WebAssembly application runs. The wwwroot/index.html file includes the following script tag:
<script src=”_framework/blazor.webassembly.js”></script>
This script tag is critical as without it the Blazor application won’t boot. Its responsible for initializing the WASM environment that hosts the Mono runtime.