preload.js with a webview within renderer process
See original GitHub issueHi,
I’m attempting to run a variable number of <webview />
tags within the renderer process (eg. BrowserWindow). Basically attempting to use IPCRenderer to pass commands to webview pages and receive the asynchronous result.
To set the communication up between the renderer
to the <webview />
, you need to add a preload
attribute like so.
In App.vue
:
<webview src="xxxxxxxx" preload="file://./enableIPC.js" nodeintegration />
.
I’ve done this with Electron as standard, however when using Vue CLI Plugin Electron Builder, I can’t get it to see and load up the enableIPC.js
file.
I’ve placed the file in the public/
folder.
I’ve tried with and without file://
, attempting to include in it within the electronBuilder preload key, with no luck. Had anybody tried this successfully and can point me to a repo?
Thanks in advance.
Note: I’m using electron version 10.1.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (3 by maintainers)
Didn’t think of that! Gave it a go and got…
Glad that you figured it out!