'How set parameters for new windows in electron
I would like know how I can set configuration width and height in new window opened in electron above my code on main.js
const {app, BrowserWindow, webContents, session} = require('electron')
let mainWindow
function createWindow () {
mainWindow = new BrowserWindow({
width: 1000, height: 800,
webPreferences: {
contextIsolation: false,
nodeIntegration: true
}
})
mainWindow.loadFile('Control/index.html')
mainWindow.setMenu(null)
mainWindow.on('closed', () => {
mainWindow = null
})
let wc = mainWindow.webContents
wc.on('new-window', (e, url) => {
e.preventDefault()
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
