From 850d8f69025512ca0389dc635339f5dabdfff683 Mon Sep 17 00:00:00 2001 From: Aeon Date: Tue, 17 Feb 2026 19:48:12 +0100 Subject: [PATCH] Add documentation for preload script and warning for Blazor --- docs/Using/Configuration.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/Using/Configuration.md b/docs/Using/Configuration.md index 63761a9..2e0e1e1 100644 --- a/docs/Using/Configuration.md +++ b/docs/Using/Configuration.md @@ -85,6 +85,26 @@ BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions ``` +### Preload Script + +If you require the use of a [preload script](https://www.electronjs.org/docs/latest/tutorial/tutorial-preload), you can specify the file path of the script when creating a new window like so: + +```csharp +WebPreferences wp = new WebPreferences(); +wp.Preload = "path/to/preload.js"; +BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions +{ + WebPreferences = wp +}; +``` + +> [!IMPORTANT] +> When using a preload script _AND_ running a Blazor app, the following lines must be added to the preload script: +> ```js +> global.process = undefined; +> global.module = undefined; +> ``` + ## 🚀 Next Steps