Skip to content

Commit 6ee299c

Browse files
trop[bot]nikwen
andauthored
docs: recommend calling renderer process modules from preload script (#48462)
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Niklas Wenzel <[email protected]>
1 parent 4e4c156 commit 6ee299c

File tree

6 files changed

+36
-0
lines changed

6 files changed

+36
-0
lines changed

docs/api/clipboard.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
55
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process) (non-sandboxed only)
66

7+
> [!IMPORTANT]
8+
> If you want to call this API from a renderer process with context isolation enabled,
9+
> place the API call in your preload script and
10+
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
11+
> [`contextBridge`](context-bridge.md) API.
12+
713
On Linux, there is also a `selection` clipboard. To manipulate it
814
you need to pass `selection` to each method:
915

docs/api/crash-reporter.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
55
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
66

7+
> [!IMPORTANT]
8+
> If you want to call this API from a renderer process with context isolation enabled,
9+
> place the API call in your preload script and
10+
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
11+
> [`contextBridge`](context-bridge.md) API.
12+
713
The following is an example of setting up Electron to automatically submit
814
crash reports to a remote server:
915

docs/api/ipc-renderer.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ changes:
2020
2121
Process: [Renderer](../glossary.md#renderer-process)
2222

23+
> [!IMPORTANT]
24+
> If you want to call this API from a renderer process with context isolation enabled,
25+
> place the API call in your preload script and
26+
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
27+
> [`contextBridge`](context-bridge.md) API.
28+
2329
The `ipcRenderer` module is an [EventEmitter][event-emitter]. It provides a few
2430
methods so you can send synchronous and asynchronous messages from the render
2531
process (web page) to the main process. You can also receive replies from the

docs/api/native-image.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
55
Process: [Main](../glossary.md#main-process), [Renderer](../glossary.md#renderer-process)
66

7+
> [!IMPORTANT]
8+
> If you want to call this API from a renderer process with context isolation enabled,
9+
> place the API call in your preload script and
10+
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
11+
> [`contextBridge`](context-bridge.md) API.
12+
713
The `nativeImage` module provides a unified interface for manipulating
814
system images. These can be handy if you want to provide multiple scaled
915
versions of the same icon or take advantage of macOS [template images][template-image].

docs/api/web-frame.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
55
Process: [Renderer](../glossary.md#renderer-process)
66

7+
> [!IMPORTANT]
8+
> If you want to call this API from a renderer process with context isolation enabled,
9+
> place the API call in your preload script and
10+
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
11+
> [`contextBridge`](context-bridge.md) API.
12+
713
`webFrame` export of the Electron module is an instance of the `WebFrame`
814
class representing the current frame. Sub-frames can be retrieved by
915
certain properties and methods (e.g. `webFrame.firstChild`).

docs/api/web-utils.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
55
Process: [Renderer](../glossary.md#renderer-process)
66

7+
> [!IMPORTANT]
8+
> If you want to call this API from a renderer process with context isolation enabled,
9+
> place the API call in your preload script and
10+
> [expose](../tutorial/context-isolation.md#after-context-isolation-enabled) it using the
11+
> [`contextBridge`](context-bridge.md) API.
12+
713
## Methods
814

915
The `webUtils` module has the following methods:

0 commit comments

Comments
 (0)