Electron preload script for webview not working?

Viewed 11027

I have this webview that I load like this:

<webview id="link-view"
        src="http://url.espace.com/"
        preload="./preload.js"
        autosize="on"
        partition="persist:link"></webview>

In the preload.js file : I have this

console.log("test");

This doesn't even work..

Can someone explain?

3 Answers

This solved my problem in electron 3.0.0-beta.4 using react.js

<webview src={'http://example.com'} preload={`file://${__dirname}/preload.js`}/>
Related