Answer the question
In order to leave comments, you need to log in
How to use @electron/remote to create a new BrowserWindow in ReactJS?
There is an application on Electron and using ReactJS. There was a need to make a new window through the component, but this does not work, and the new window in the console has the error "@electron/remote is disabled for this WebContents. Call require("@electron/remote/main").enable(webContents) to enable it."
Main.js:
const mainWindow = new BrowserWindow({
width: 1280,
height: 720,
show: false,
webPreferences: {
nodeIntegration: true,
enableRemoteModule: true,
contextIsolation: false,
webSecurity: false
},
})
require("@electron/remote/main").initialize();
require("@electron/remote/main").enable(mainWindow.webContents);
function createWindow () {
let win = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
webSecurity: false
},
})
window.require("@electron/remote/main").enable(win.webContents);
win.loadURL('http://localhost:3000/overlay')
}
createWindow()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question