Created
July 4, 2018 09:37
-
-
Save Gvozd/2cec0c8c510a707854e439fb15c561b0 to your computer and use it in GitHub Desktop.
Facebook, OAuth login. Correct opener in window
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
mainWindow = new BrowserWindow({ | |
webPreferences: { | |
nativeWindowOpen: true,// window.open return Window object(like in regular browsers), not BrowserWindowProxy | |
affinity: 'main-window'// main window, and addition windows should work in one process | |
} | |
}); | |
mainWindow.webContents.on('new-window', function (e, url, frameName, disposition, options) { | |
// hook on new opened window | |
// at now new window in mainWindow renderer process. | |
// Also, this will automatically get an option `nodeIntegration=false`(not override to true, like in iframe's) - like in regular browsers | |
options.webPreferences.affinity = 'main-window'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This worked(in your example, prevention is forgotten):
I also want to note that the workaround works only in the electron@2
In my last tests, this solution not actually worked at electron@3-4