Skip to content

Commit 746b5f1

Browse files
committed
Fix Google login
1 parent 474bfd1 commit 746b5f1

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

index.js

+15-2
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,10 @@ function createMainWindow() {
4242
backgroundColor: "#000",
4343
show : false,
4444
webPreferences : {
45-
nodeIntegration: false,
46-
preload : path.join(__dirname, "preload.js")
45+
nodeIntegration : false,
46+
preload : path.join(__dirname, "preload.js"),
47+
nativeWindowOpen: true, // window.open return Window object(like in regular browsers), not BrowserWindowProxy
48+
affinity : "main-window" // main window, and addition windows should work in one process
4749
},
4850
frame : !is.macOS(),
4951
titleBarStyle: is.macOS() ? "hiddenInset": "default"
@@ -86,6 +88,17 @@ function createMainWindow() {
8688
}
8789
});
8890

91+
win.webContents.on(
92+
"new-window",
93+
(e, url, frameName, disposition, options) => {
94+
// hook on new opened window
95+
96+
// at now new window in mainWindow renderer process.
97+
// Also, this will automatically get an option `nodeIntegration=false`(not override to true, like in iframe's) - like in regular browsers
98+
options.webPreferences.affinity = "main-window";
99+
}
100+
);
101+
89102
win.on("move", () => {
90103
let position = win.getPosition();
91104
store.set("window-position", { x: position[0], y: position[1] });

0 commit comments

Comments
 (0)