electron/remote

"@electron/remote is disabled for this WebContents" with mutiple BrowserWindows

Elyspio opened this issue · 1 comments

Hello,

I have some an issue with the @electron/remote "enable" method.

It works fine for the first BrowserWindow (created by the main process).

But it gives me the following error when I'm doing it from the created window : "@electron/remote is disabled for this WebContents. Call require("@electron/remote/main").enable(webContents) to enable it".

Here is my code:

const { dialog, BrowserWindow, require: nodeRequire } = require("@electron/remote");


// called from the renderer process

const win = new BrowserWindow({
    ...windowOption,
});

nodeRequire("@electron/remote/main").enable(win.webContents);

win.loadURL(...)

I'm using electron 17 and @electron/remote 2.0.5

Do you have any tips please ?

Sincerely

ncaq commented

I tried this comment and it probably solves the problem.
#94 (comment)