You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: aspnetcore/host-and-deploy/blazor/webassembly.md
+71-2Lines changed: 71 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ description: Learn how to host and deploy a Blazor app using ASP.NET Core, Conte
5
5
monikerRange: '>= aspnetcore-3.1'
6
6
ms.author: riande
7
7
ms.custom: mvc
8
-
ms.date: 04/23/2020
8
+
ms.date: 04/30/2020
9
9
no-loc: [Blazor, SignalR]
10
10
uid: host-and-deploy/blazor/webassembly
11
11
---
12
12
# Host and deploy ASP.NET Core Blazor WebAssembly
13
13
14
-
By [Luke Latham](https://github.com/guardrex), [Rainer Stropek](https://www.timecockpit.com), [Daniel Roth](https://github.com/danroth27), and [Ben Adams](https://twitter.com/ben_a_adams).
14
+
By [Luke Latham](https://github.com/guardrex), [Rainer Stropek](https://www.timecockpit.com), [Daniel Roth](https://github.com/danroth27), [Ben Adams](https://twitter.com/ben_a_adams), and [Safia Abdalla](https://safia.rocks)
@@ -325,3 +325,72 @@ The `--urls` argument sets the IP addresses or host addresses with ports and pro
325
325
## Configure the Linker
326
326
327
327
Blazor performs Intermediate Language (IL) linking on each Release build to remove unnecessary IL from the output assemblies. For more information, see <xref:host-and-deploy/blazor/configure-linker>.
328
+
329
+
## Custom boot resource loading
330
+
331
+
A Blazor WebAssembly app can be initialized with the `loadBootResource` function to override the built-in boot resource loading mechanism. Use `loadBootResource` for the following scenarios:
332
+
333
+
* Allow users to load static resources, such as timezone data or *dotnet.wasm* from a CDN.
334
+
* Load compressed assemblies using an HTTP request and decompress them on the client for hosts that don't support fetching compressed contents from the server.
335
+
* Alias resources to a different name by redirecting each `fetch` request to a new name.
336
+
337
+
`loadBootResource` parameters appear in the following table.
338
+
339
+
| Parameter | Description |
340
+
| ------------ | ----------- |
341
+
|`type`| The type of the resource. Permissable types: `assembly`, `pdb`, `dotnetjs`, `dotnetwasm`, `timezonedata`|
342
+
|`name`| The name of the resource. |
343
+
|`defaultUri`| The relative or absolute URI of the resource. |
344
+
|`integrity`| The integrity string representing the expected content in the response. |
345
+
346
+
`loadBootResource` returns any of the following to override the loading process:
347
+
348
+
* URI string. In the following example (*wwwroot/index.html*), the following files are served from a CDN at `https://my-awesome-cdn.com/`:
*`Promise<Response>`. Pass the `integrity` parameter in a header to retain the default integrity-checking behavior.
374
+
375
+
The following example (*wwwroot/index.html*) adds a custom HTTP header to the outbound requests and passes the `integrity` parameter through to the `fetch` call:
*`null`/`undefined`, which results in the default loading behavior.
393
+
394
+
External sources must return the required CORS headers for browsers to allow the cross-origin resource loading. CDNs usually provide the required headers by default.
395
+
396
+
You only need to specify types for custom behaviors. Types not specified to `loadBootResource` are loaded by the framework per their default loading behaviors.
0 commit comments