Created
November 6, 2023 08:28
-
-
Save t57ser/386ccff1527e798c3dd0e26180e5fe3b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Title</title> | |
</head> | |
<body> | |
Text | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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