I have built a electron app - https://github.com/WebDevLabs-SVNIT/cyclient. I want to load the URL from electron menu options. For this I have created a menu called settings and on clicking it I am calling settings.html via ipc render. Currently I have to add the Url manually but it should be user defined. How can I do this? I am having hard time figuring this out. Is it possible to have a mainWindow.loadUrl = somevariable and load it via input value of the field.
My main.js contains this code -
app.on('ready', function() {
mainWindow = new BrowserWindow({
frame: false,
height: 700,
resizable: false,
width: 368
});
mainWindow.loadUrl('file://' + __dirname + '/app/index.html');
});
ipc.on('open-settings-window', function () {
if (settingsWindow) {
return;
}
settingsWindow = new BrowserWindow({
frame: false,
height: 200,
resizable: false,
width: 200
});
settingsWindow.loadUrl('file://' + __dirname + '/app/settings.html');
settingsWindow.on('closed', function () {
settingsWindow = null;
});
});