Skip to content

Instantly share code, notes, and snippets.

@t57ser
Created November 6, 2023 08:28
Show Gist options
  • Save t57ser/386ccff1527e798c3dd0e26180e5fe3b to your computer and use it in GitHub Desktop.
Save t57ser/386ccff1527e798c3dd0e26180e5fe3b to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
Text
</body>
</html>
let { app, BrowserWindow } = require("electron")
function createWindow() {
let win2 = new BrowserWindow({
frame: false,
transparent: false,
webPreferences: {
nodeIntegration: false,
plugins: true,
sandbox: true,
webgl: true,
nodeIntegrationInSubFrames: true,
allowRunningInsecureContent: false,
webSecurity: true,
spellcheck: true,
enablePreferredSizeMode: true,
partition: "persist:partition",
contextIsolation: false,
}
})
win2.loadFile("index.html").then(() => {
win2.webContents.openDevTools({mode: "detach"})
}).catch(console.log);
win2.webContents.setWindowOpenHandler((details) => {
return {
action: "allow",
overrideBrowserWindowOptions: {
webPreferences: {
nodeIntegration: false,
plugins: true,
sandbox: true,
webgl: true,
nodeIntegrationInSubFrames: true,
allowRunningInsecureContent: false,
webSecurity: true,
spellcheck: true,
enablePreferredSizeMode: true,
partition: "persist:partition",
contextIsolation: false,
}
},
outlivesOpener: true,
};
});
}
app.on("ready", createWindow)
app.on("window-all-closed", () => {
app.quit()
})
{
"main": "main.js",
"scripts": {
"start": "electron ."
},
"devDependencies": {
"electron": "26.4.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment