Access BrowserView DOM objects in Electron.NET #561

Closed
opened 2026-01-29 16:42:57 +00:00 by claunia · 2 comments
Owner

Originally created by @PeterPolaschek on GitHub (Aug 24, 2020).

Originally assigned to: @GregorBiswanger on GitHub.

Hi guys,
I have an Electron App with a BrowserView in the main BrowserWindow. In the BrowserView, I load an external URL:

// main.js:
BrowserWindow mainWindow = new BrowserWindow(...);
BrowserView view = new BrowserView(...);
mainWindow.setBrowserView(view);
view.webContents.loadURL(...);

To access the BrowserView's content, I send it to the renderer.js:

// main.js:
ipcMain.on("event", function (event, arg) {
    view.webContents.send("channel");
});

In renderer.js, I can access the BrowserView's content:

// renderer.js
ipcRenderer.on("channel", () => {
    var html = document.getElementById("elementId").innerHTML;
});

I want to do the same within an Electron.NET application but there doesn't seem to be the following function:
view.webContents.send("channel");

Will this functionality or an equivalent be available in Electron.NET anytime soon?

Originally created by @PeterPolaschek on GitHub (Aug 24, 2020). Originally assigned to: @GregorBiswanger on GitHub. Hi guys, I have an Electron App with a BrowserView in the main BrowserWindow. In the BrowserView, I load an external URL: ``` // main.js: BrowserWindow mainWindow = new BrowserWindow(...); BrowserView view = new BrowserView(...); mainWindow.setBrowserView(view); view.webContents.loadURL(...); ``` To access the BrowserView's content, I send it to the renderer.js: ``` // main.js: ipcMain.on("event", function (event, arg) { view.webContents.send("channel"); }); ``` In renderer.js, I can access the BrowserView's content: ``` // renderer.js ipcRenderer.on("channel", () => { var html = document.getElementById("elementId").innerHTML; }); ``` I want to do the same within an Electron.NET application but there doesn't seem to be the following function: `view.webContents.send("channel");` Will this functionality or an equivalent be available in Electron.NET anytime soon?
claunia added the Feature label 2026-01-29 16:42:57 +00:00
Author
Owner

@freosc commented on GitHub (Aug 26, 2020):

If you take a look at the IPC view and controller in the ElectronNET.WebApp example project, you'll see how it's done.

var mainWindow = Electron.WindowManager.BrowserWindows.First();
Electron.IpcMain.Send(mainWindow, "channel", "argument");
@freosc commented on GitHub (Aug 26, 2020): If you take a look at the IPC view and controller in the ElectronNET.WebApp example project, you'll see how it's done. ``` var mainWindow = Electron.WindowManager.BrowserWindows.First(); Electron.IpcMain.Send(mainWindow, "channel", "argument"); ```
Author
Owner

@GregorBiswanger commented on GitHub (Mar 28, 2023):

🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉

With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!

@GregorBiswanger commented on GitHub (Mar 28, 2023): 🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉 With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#561