Skip to content

Commit 572fc05

Browse files
committed
Document contextIsolation option
1 parent b348cde commit 572fc05

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/api/browser-window.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,17 @@ It creates a new `BrowserWindow` with native properties as set by the `options`.
282282
[offscreen rendering tutorial](../tutorial/offscreen-rendering.md) for
283283
more details.
284284
* `sandbox` Boolean (optional) - Whether to enable Chromium OS-level sandbox.
285+
* `contextIsolation` Boolean (optional) - Whether to run Electron APIs and
286+
the specified `preload` script in a separate JavaScript context. Defaults
287+
to `false`. The context that the `preload` script runs in will still
288+
have full access to the `document` and `window` globals but it will use
289+
its own set of JavaScript builtins (`Array`, `Object`, `JSON`, etc.)
290+
and will be isolated from any changes made to the global environment
291+
by the loaded page. The Electron API will only be available in the
292+
`preload` script and not the loaded page. This option should be used when
293+
loading potentially untrusted remote content to ensure the loaded content
294+
cannot tamper with the `preload` script and any Electron APIs being used.
295+
This option uses the same technique used by [Chrome Content Scripts][chrome-content-scripts].
285296

286297
When setting minimum or maximum window size with `minWidth`/`maxWidth`/
287298
`minHeight`/`maxHeight`, it only constrains the users. It won't prevent you from
@@ -1254,3 +1265,4 @@ will remove the vibrancy effect on the window.
12541265
[quick-look]: https://en.wikipedia.org/wiki/Quick_Look
12551266
[vibrancy-docs]: https://developer.apple.com/reference/appkit/nsvisualeffectview?language=objc
12561267
[window-levels]: https://developer.apple.com/reference/appkit/nswindow/1664726-window_levels
1268+
[chrome-content-scripts]: https://developer.chrome.com/extensions/content_scripts#execution-environment

0 commit comments

Comments
 (0)