const { app, BrowserWindow } = require('electron')
app.on('ready', () => {
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreference: {
nodeIntegration: true
}
})
mainWindow.loadFile('index.html')
const secondWindow = new BrowserWindow({
width: 300,
height: 300,
webPreference: {
nodeIntegration: true
},
parent: mainWindow
})
secondWindow.loadFile('second.html')
})
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Hellow World!</title>
</head>
<body>
<h1>Hellow World!</h1>
<script>
require('./renderer.js')
</script>
</body>
</html>
// This file is required by the index.html file and will
// be executed in the renderer process for that window.
// All of the Node.js APIs are available in this process.
alert(process.versions.node)
alert(111111)