Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Elyspio opened this issue Feb 27, 2022 · 1 comment

Comments

@Elyspio
Copy link

Elyspio commented Feb 27, 2022

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

@Elyspio Elyspio changed the title @electron/remote is disabled for this WebContents with mutiple windows "@electron/remote is disabled for this WebContents" with mutiple BrowserWindows Feb 27, 2022
@ncaq
Copy link

ncaq commented May 31, 2022

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

@Elyspio Elyspio closed this as completed May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants