The webContents
class is one of the most important classes available inside the Electron to work with the rendered web page from the main process. Basically, this class is an event emitter that is responsible for rendering and controlling a typical web page inside the browser window. So, you can use this class to manage your web page behavior and customize the rendering pipeline in your Electron shell or browser window. Reference to this API can be retrieved using getter property inside the BrowserWindow
class, as follows:
// In your main process const { BrowserWindow } = require('electron'); var appShell = new electron.BrowserWindow({ width: 600, height: 400 }); win.loadURL(`file://${__dirname}/index.html`) win.on('closed', () => appShell = null); // access the webContent object var content = appShell.webContents;
This class provides a number of events that can be hooked into the various stages in a page-rendering pipeline. You can manage...