Skip to content

Commit e28eadc

Browse files
committed
Merge branch 'develop' of https://github.com/ElectronNET/Electron.NET into develop
2 parents 9a935c0 + c22c248 commit e28eadc

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/Using/Configuration.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,26 @@ BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
8585
```
8686

8787

88+
### Preload Script
89+
90+
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:
91+
92+
```csharp
93+
WebPreferences wp = new WebPreferences();
94+
wp.Preload = "path/to/preload.js";
95+
BrowserWindowOptions browserWindowOptions = new BrowserWindowOptions
96+
{
97+
WebPreferences = wp
98+
};
99+
```
100+
101+
> [!IMPORTANT]
102+
> When using a preload script _AND_ running a Blazor app, `IsRunningBlazor` must be set to `false` (or removed) and the following lines must be added to the preload script:
103+
> ```js
104+
> global.process = undefined;
105+
> global.module = undefined;
106+
> ```
107+
88108
89109
## 🚀 Next Steps
90110

0 commit comments

Comments
 (0)