Is it possible to identify whether an external URL is loaded successfully or not from the main process, when window.open("http://example.com")
is called from the renderer process?
Something like…
mainWindow.webContents.on('did-url-load', () => {
// Do something
});
mainWindow.webContents.on('did-url-loading-failed', () => {
// Do something
});
2
Answers
On MDN’s Window.open() page:
So, i think you should just check for the return value of window.open:
In case you have control over the page you’d like to open, you could use cross window communication methods. In the new window you hook into an events that fits your needs (onload?) and send a mesg over to the other window.
Maybe an Iframe also serves your needs?
Have a look at:
https://javascript.info/cross-window-communication
Cheers