Skip to content

Instantly share code, notes, and snippets.

@ckerr
Created December 16, 2020 19:04
Show Gist options
  • Save ckerr/60e0abec2f1dc3f92127b875b8c2393e to your computer and use it in GitHub Desktop.
Save ckerr/60e0abec2f1dc3f92127b875b8c2393e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<body>
<button id="b">Open window</button>
<script src="./renderer.js"></script>
</body>
</html>
const { app, BrowserWindow } = require('electron')
function createWindow() {
const mainWindow = new BrowserWindow({
webPreferences: {
nodeIntegration: true,
nativeWindowOpen: true
}
})
mainWindow.loadFile('index.html')
mainWindow.webContents.on("new-window", (e, url, f, d, op) => {
console.log(op.title);
})
}
app.whenReady().then(() => {
createWindow()
})
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
document.getElementById("b").onclick = () => {
window.open("https://google.com", "aaa");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment