diff --git a/src/main.js b/src/main.js index 330a0463..824602a5 100644 --- a/src/main.js +++ b/src/main.js @@ -355,6 +355,7 @@ function handleAppWillFinishLaunching() { function handleAppWebContentsCreated(dc, contents) { contents.on('will-attach-webview', (event, webPreferences) => { webPreferences.nodeIntegration = false; + webPreferences.contextIsolation = true; }); contents.on('will-navigate', (event, navigationUrl) => { const parsedUrl = new URL(navigationUrl); diff --git a/src/main/mainWindow.js b/src/main/mainWindow.js index 5793b59c..df02e923 100644 --- a/src/main/mainWindow.js +++ b/src/main/mainWindow.js @@ -45,6 +45,7 @@ function createMainWindow(config, options) { fullscreen: false, webPreferences: { nodeIntegration: true, + contextIsolation: false, webviewTag: true, }, }); @@ -71,6 +72,7 @@ function createMainWindow(config, options) { mainWindow.webContents.on('will-attach-webview', (event, webPreferences) => { webPreferences.nodeIntegration = false; + webPreferences.contextIsolation = true; }); mainWindow.once('ready-to-show', () => {