I have a button in my index.html that I would like to open a second window when clicked.
I have added the following to my index.js:
const button = document.getElementById('newtask');
button.addEventListener('click', () => {
newtaskwindow();
});
function newtaskwindow() {
const BrowserWindow = remote.BrowserWindow;
const win = new BrowserWindow({
height: 400,
width: 600
});
win.loadURL('createtasks.html');
}
I had to create a second js file and input:
const button = document.getElementById('newtask');
button.addEventListener('click', () => {
newtaskwindow();
});
function newtaskwindow() {
const remote = require('electron').remote;
const BrowserWindow = remote.BrowserWindow;
const win = new BrowserWindow({
height: 600,
width: 800
});
win.loadURL('createtasks.html');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.