Overview
Startup is asynchronous and automatic via blazor.web|server|webassembly.js.
manually starting blazor
manually starting blazor web app
- Add
autostart="false"to the Blazor<script>tag. - Place a script that calls
Blazor.start()after the<script>tag inside the closing<body>tag. - Place static SSR options in the
ssrproperty. - Place server-side Blazor SignalR circuit options in the
circuitproperty. - Place client-side WebAssembly options in the
webAssemblyproperty.
<script src="{BLAZOR SCRIPT}" autostart="false"></script>
<script>
...
Blazor.start({
ssr: {
...
},
circuit: {
...
},
webAssembly: {
...
}
});
...
</script>
manually starting standalone blazor wasm and blazor server
- Add
autostart="false"to the Blazor<script>tag. - Place a script that calls
Blazor.start()after the<script>tag inside the closing<body>tag. - Add any options in the
Blazor.start()parameter.
<script src="{BLAZOR SCRIPT}" autostart="false"></script>
<script>
...
Blazor.start({
...
});
...
</script>
javascript initializers
JS initializers execute logic before and after a Blazor app loads.
initialize blazor when the document is ready
<script src="{BLAZOR SCRIPT}" autostart="false"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
Blazor.start();
});
</script>