I am new to electron and I am getting this in the console (of DevTools) of every BrowserWindow
I open:
webFrame.executeJavaScript was called without worldSafeExecuteJavaScript enabled. This is considered unsafe. worldSafeExecuteJavaScript will be enabled by default in Electron 12.
I am also getting one more security warning and that is:
Electron Security Warning (Insecure Content-Security-Policy) This renderer process has either no Content Security
Policy set or a policy with "unsafe-eval" enabled. This exposes users of
this app to unnecessary security risks.
I don't know what exactly I am doing wrong...!!
This is my console window
This is my package.json
Add the following setting to your BrowserWindow in main.js
webPreferences { worldSafeExecuteJavaScript: true, contextIsolation: true }
For reference, see:
Add the following to the head of your index.html and any other html pages if you are loading locally
<meta http-equiv="Content-Security-Policy" content="script-src 'self'">
For reference, see:
First add a CSP policy, like this one:
<meta http-equiv="Content-Security-Policy" content="default-src 'self'">
This may break some scripts, but it's better to do this. Also you can enable unsafe-inline
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With