[Pre ?] Blazor startup options format
Fixes #34659
🛑 HOLD ✋
... and note that this will need What's New coverage.
https://github.com/dotnet/aspnetcore/pull/54649 wasn't merged. It's not clear if https://github.com/dotnet/aspnetcore/issues/51611 will be worked for .NET 10.
Internal previews
Reverting Host and deploy > WebAssembly (Compression section) content to unblock work in the Host and deploy node. These changes should be re-introduced after the Host and deploy work is performed.
:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0"
Blazor Web App:
:::moniker-end
:::moniker range=">= aspnetcore-8.0"
html
<script type="module">
import { BrotliDecode } from './decode.min.js';
Blazor.start({
webAssembly: {
loadBootResource: function (type, name, defaultUri, integrity) {
if (type !== 'dotnetjs' && location.hostname !== 'localhost' && type !== 'configuration' && type !== 'manifest') {
return (async function () {
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
throw new Error(response.statusText);
}
const originalResponseBuffer = await response.arrayBuffer();
const originalResponseArray = new Int8Array(originalResponseBuffer);
const decompressedResponseArray = BrotliDecode(originalResponseArray);
const contentType = type ===
'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
return new Response(decompressedResponseArray,
{ headers: { 'content-type': contentType } });
})();
}
}
}
});
</script>
:::moniker-end
:::moniker range=">= aspnetcore-8.0 < aspnetcore-10.0"
Standalone Blazor WebAssembly:
:::moniker-end
:::moniker range="< aspnetcore-10.0"
html
<script type="module">
import { BrotliDecode } from './decode.min.js';
Blazor.start({
loadBootResource: function (type, name, defaultUri, integrity) {
if (type !== 'dotnetjs' && location.hostname !== 'localhost' && type !== 'configuration') {
return (async function () {
const response = await fetch(defaultUri + '.br', { cache: 'no-cache' });
if (!response.ok) {
throw new Error(response.statusText);
}
const originalResponseBuffer = await response.arrayBuffer();
const originalResponseArray = new Int8Array(originalResponseBuffer);
const decompressedResponseArray = BrotliDecode(originalResponseArray);
const contentType = type ===
'dotnetwasm' ? 'application/wasm' : 'application/octet-stream';
return new Response(decompressedResponseArray,
{ headers: { 'content-type': contentType } });
})();
}
}
});
</script>
:::moniker-end
@Rick-Anderson @wadepickett ... Either we'll need a SiteHelp ticket on this or a force merge because the warnings for aspnetcore/blazor/host-and-deploy/webassembly/index.md here are inaccurate ...
Line 130: [Warning] HTML tag 'script' isn't allowed. Replace it with approved Markdown or escape the brackets if the content is a placeholder. Line 167: [Warning] HTML tag 'script' isn't allowed. Replace it with approved Markdown or escape the brackets if the content is a placeholder.
There are no <script> tags on the lines indicated, and all <script> tags in the markdown are code-fenced or are part of a code block.
@Rick-Anderson @wadepickett ... Nevermind! There is something wrong with the file after all. Somehow, my backticks were stripped off of my code languages in two code blocks. I'll fix it up.
UPDATE: I see what happened here. I placed the content into a GH issue comment. To have the code appear alongside the text, I removed the backticks for the issue comment. When I went to place the content+code back into the article, I didn't add the backticks after pasting. 🙈
I'm not off to a great start here! Let's hope the day goes better! 😆
@maraf ... Dan doesn't think Blazor.start will make the cut for .NET 10. Closing the docs PR now, which is a bit of a 😢 because it was a bit of a pain to set this up 💸.
I'm sorry for that :(